2 文件已重命名
7个文件已添加
3个文件已删除
32个文件已修改
| | |
| | | package com.consum.base; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.iplatform.base.PlatformAdapterController; |
| | | import com.iplatform.base.util.UserUtils; |
| | | import com.iplatform.core.BeanContextAware; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | |
| | | public abstract class BaseController extends PlatformAdapterController { |
| | | |
| | |
| | | OutputStream out = response.getOutputStream(); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | workbook.write(byteArrayOutputStream); |
| | | response.setHeader("Content-Length", String.valueOf(byteArrayOutputStream.size())); |
| | |
| | | workbook.close(); |
| | | out.close(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.FinSysTenantUserSearchParam; |
| | | import com.consum.base.pojo.FinSysTenantUserUpdParam; |
| | |
| | | import com.walker.infrastructure.utils.PhoneNumberUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * @Description 系统用户 |
| | |
| | | |
| | | private UserServiceImpl userService; |
| | | |
| | | |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | |
| | | private RoleServiceImpl roleService; |
| | |
| | | @Autowired |
| | | private FinSysTenantDepartmentService finSysTenantDepartmentService; |
| | | |
| | | |
| | | @Autowired |
| | | public void setUserService(UserServiceImpl userService) { |
| | | this.userService = userService; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | public FinSysTenantUserController(FinSysTenantServiceImpl finSysTenantService, FinSysTenantUserServiceImpl finSysTenantUserService, |
| | | RoleServiceImpl roleService) { |
| | | public FinSysTenantUserController(FinSysTenantServiceImpl finSysTenantService, |
| | | FinSysTenantUserServiceImpl finSysTenantUserService, RoleServiceImpl roleService) { |
| | | this.finSysTenantUserService = finSysTenantUserService; |
| | | this.finSysTenantService = finSysTenantService; |
| | | this.roleService = roleService; |
| | |
| | | * @Date 2023/7/11 13:59 |
| | | */ |
| | | @RequestMapping("/select/list") |
| | | public ResponseValue allocatedList(FinSysTenantUserSearchParam param) { |
| | | public ResponseValue allocatedList() { |
| | | FinSysTenantUserSearchParam param = CommonUtil.getObjFromReq(FinSysTenantUserSearchParam.class); |
| | | FinSysTenantUserSearchParam param2 = new FinSysTenantUserSearchParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | if (param.getTenantCode() == 0) { |
| | | FinSysTenantUser user = new FinSysTenantUser(); |
| | | Long id = this.getCurrentUser().getId(); |
| | |
| | | finSysTenantUser.setRoleStr(roleStr); |
| | | } |
| | | |
| | | //循环查询运维商id |
| | | // 循环查询运维商id |
| | | if (finSysTenantUser.getSupplierId() != null) { |
| | | finSysTenantUser.setIsSupplier("是"); |
| | | } else { |
| | |
| | | |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(pager, resultList); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(pager, resultList); |
| | | ReflectUtil.setFieldValue(pager, fieldDatas, resultList); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.error("分页列表查询失败,原因:" + e); |
| | | } |
| | | return ResponseValue.success(pager); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "根据机构id查询用户", notes = "根据机构id查询用户") |
| | | @ApiImplicitParam(name = "tenantId", value = "机构id", required = true, dataType = "Long", paramType = "query") |
| | |
| | | return ResponseValue.success(result); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 新增 |
| | | * @Author wh |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResponseValue add(@RequestBody FinSysTenantUser user) { |
| | | public ResponseValue add() { |
| | | FinSysTenantUser user = CommonUtil.getObjFromReqBody(FinSysTenantUser.class); |
| | | FinSysTenantUser formInventoryParam = new FinSysTenantUser(); |
| | | CommonUtil.copyProperties(user, formInventoryParam); |
| | | user = formInventoryParam; |
| | | if (user == null) { |
| | | return ResponseValue.error("参数为空"); |
| | | } |
| | | //根据员工编号查询,如果存在则提示 |
| | | if (finSysTenantUserService.getByUserCode(user.getUserCode()) != null && finSysTenantUserService.getByUserCode(user.getUserCode()) > 0) { |
| | | // 根据员工编号查询,如果存在则提示 |
| | | if (finSysTenantUserService.getByUserCode(user.getUserCode()) != null |
| | | && finSysTenantUserService.getByUserCode(user.getUserCode()) > 0) { |
| | | return ResponseValue.error("员工编号重复"); |
| | | } |
| | | if (user.getTenantId() == null || "".equals(user.getTenantId()) || new Integer(user.getTenantId()) == 0) { |
| | |
| | | if (user.getTenantCode() == null || "".equals(user.getTenantCode()) || new Integer(user.getTenantCode()) == 0) { |
| | | return ResponseValue.error("添加时请选择区县"); |
| | | } |
| | | //插入系统用户 |
| | | // 插入系统用户 |
| | | user.setId(NumberGenerator.getLongSequenceNumber()); |
| | | user.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | user.setCreateBy(this.getCurrentUser().getUser_name()); |
| | | user.setUpdateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | user.setUpdateBy(this.getCurrentUser().getUser_name()); |
| | | //user.setStatus(1);// 0禁用 1启用 |
| | | // user.setStatus(1);// 0禁用 1启用 |
| | | user.setIsDelete(0); |
| | | user.setSysUserId(NumberGenerator.getLongSequenceNumber()); |
| | | // 加密手机号 |
| | |
| | | encPhone = AESUtils.encryptStrAES(user.getUserPhone(), key); |
| | | } |
| | | user.setUserPhone(encPhone); |
| | | //怎么获取左侧机构树数据 |
| | | user.setSysDeptId(3L); //对应平台机构id 默认为平台管理 |
| | | // 怎么获取左侧机构树数据 |
| | | user.setSysDeptId(3L); // 对应平台机构id 默认为平台管理 |
| | | this.finSysTenantUserService.insert(user); |
| | | // 插入平台用户 |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(user.getSysUserId()); |
| | | userCore.setDept_id(3L); //部门id,目前写死 |
| | | userCore.setOrg_id(user.getSysDeptId()); //机构id |
| | | userCore.setDept_id(3L); // 部门id,目前写死 |
| | | userCore.setOrg_id(user.getSysDeptId()); // 机构id |
| | | userCore.setOrg_id(1L); |
| | | userCore.setUser_name(user.getUserCode()); //用户账号 |
| | | userCore.setUser_name(user.getUserCode()); // 用户账号 |
| | | userCore.setNick_name(user.getUserName()); |
| | | //用户类型 先默认设置为2 |
| | | // 用户类型 先默认设置为2 |
| | | userCore.setUser_type(2); |
| | | userCore.setPhonenumber(encPhone); |
| | | userCore.setSex(user.getSex().toString()); |
| | | //初始化密码 123456 |
| | | // 初始化密码 123456 |
| | | String pws = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); |
| | | userCore.setPassword(pws); |
| | | // 平台用户表和系统用户 表状态相反 |
| | |
| | | userCore.setIs_logoff(0); |
| | | userCore.setLogoff_time(0L); |
| | | userCore.setIs_sms(0); |
| | | //管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | // 管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | userCore.setType(1); |
| | | //商户id,0-平台 |
| | | // 商户id,0-平台 |
| | | userCore.setMer_id(0L); |
| | | this.userService.insert(userCore); |
| | | // 插入平台机构 |
| | | //少角色id |
| | | List<Long> roleList = user.getRoleList(); //机构id 多个 |
| | | // 少角色id |
| | | List<Long> roleList = user.getRoleList(); // 机构id 多个 |
| | | if (!CollectionUtils.isEmpty(roleList)) { |
| | | Long sysUserId = user.getSysUserId(); //用户id |
| | | Long sysUserId = user.getSysUserId(); // 用户id |
| | | this.finSysTenantUserService.execInsertRoleUserList(roleList, sysUserId); |
| | | } |
| | | // this.getFinCustomerCache().remove(); |
| | | // this.getFinCustomerCache().remove(); |
| | | return ResponseValue.success(1); |
| | | } |
| | | |
| | | |
| | | public static class ImportUserParam { |
| | | |
| | |
| | | * @Date 2023/10/12 15:56 |
| | | */ |
| | | @PostMapping("/import") |
| | | public ResponseValue importUser(@RequestParam String tenantId, @RequestParam String tenantCode, MultipartFile file) throws IOException { |
| | | public ResponseValue importUser(@RequestParam String tenantId, @RequestParam String tenantCode, MultipartFile file) |
| | | throws IOException { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (!"xls".equals(originalFilename.substring(originalFilename.lastIndexOf(".") + 1))) { |
| | | return ResponseValue.error("文件格式有误!"); |
| | |
| | | EasyExcel.read(file.getInputStream(), ImportUserParam.class, new AnalysisEventListener<ImportUserParam>() { |
| | | @Override |
| | | public void invoke(ImportUserParam data, AnalysisContext context) { |
| | | if (StringUtils.isEmpty(data.getUserName()) || StringUtils.isEmpty(data.getUserCode()) || StringUtils.isEmpty(data.getUserPhone()) |
| | | || null == data.getSex() || StringUtils.isEmpty(data.getEmail()) || null == data.getSeq() || StringUtils.isEmpty(data.getRoleName())) { |
| | | if (StringUtils.isEmpty(data.getUserName()) || StringUtils.isEmpty(data.getUserCode()) |
| | | || StringUtils.isEmpty(data.getUserPhone()) || null == data.getSex() |
| | | || StringUtils.isEmpty(data.getEmail()) || null == data.getSeq() |
| | | || StringUtils.isEmpty(data.getRoleName())) { |
| | | throw new ImportUserParamVerifyException("单元格不能为空!"); |
| | | } |
| | | //根据员工编号查询,如果存在则提示 |
| | | // 根据员工编号查询,如果存在则提示 |
| | | if (finSysTenantUserService.getByUserCode(data.getUserCode()) > 0) { |
| | | throw new ImportUserParamVerifyException("员工编号为空或已存在!"); |
| | | } |
| | |
| | | user.setSeq(data.getSeq()); |
| | | user.setTenantId(tenantId); |
| | | user.setTenantCode(tenantCode); |
| | | //设置角色 |
| | | Optional<S_role> sRole = roles.stream().filter(role -> role.getRole_name().equals(data.getRoleName())).findFirst(); |
| | | // 设置角色 |
| | | Optional<S_role> sRole = |
| | | roles.stream().filter(role -> role.getRole_name().equals(data.getRoleName())).findFirst(); |
| | | user.setRoleList(Arrays.asList(sRole.orElse(new S_role()).getRole_id())); |
| | | |
| | | user.setId(NumberGenerator.getLongSequenceNumber()); |
| | |
| | | user.setUserPhone(encPhone); |
| | | |
| | | user.setIsDelete(1); |
| | | //怎么获取左侧机构树数据 |
| | | user.setSysDeptId(3L); //对应平台机构id 默认为平台管理 |
| | | // 怎么获取左侧机构树数据 |
| | | user.setSysDeptId(3L); // 对应平台机构id 默认为平台管理 |
| | | finSysTenantUsers.add(user); |
| | | } |
| | | |
| | |
| | | if (exception != null) { |
| | | // 如果是某一个单元格的转换异常 能获取到具体行号 封装时异常 |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; |
| | | logger.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(), excelDataConvertException.getColumnIndex() + 1, |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException)exception; |
| | | logger.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(), |
| | | excelDataConvertException.getColumnIndex() + 1, |
| | | excelDataConvertException.getCellData().getStringValue()); |
| | | throw new IllegalStateException( |
| | | "第" + (excelDataConvertException.getRowIndex() + 1) + "行,第" + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ " |
| | | + excelDataConvertException.getCellData().getStringValue() + " ]"); |
| | | throw new IllegalStateException("第" + (excelDataConvertException.getRowIndex() + 1) + "行,第" |
| | | + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,异常数据为:[ " |
| | | + excelDataConvertException.getCellData().getStringValue() + " ]"); |
| | | } |
| | | if (exception instanceof ImportUserParamVerifyException) { |
| | | throw new IllegalStateException("第" + context.readSheetHolder().getRowIndex() + "行, 解析错误:[ " + exception.getMessage() + " ]"); |
| | | throw new IllegalStateException("第" + context.readSheetHolder().getRowIndex() + "行, 解析错误:[ " |
| | | + exception.getMessage() + " ]"); |
| | | } |
| | | throw exception; |
| | | } |
| | |
| | | // 插入平台用户 |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(user.getSysUserId()); |
| | | userCore.setDept_id(3L); //部门id,目前写死 |
| | | userCore.setOrg_id(user.getSysDeptId()); //机构id |
| | | userCore.setDept_id(3L); // 部门id,目前写死 |
| | | userCore.setOrg_id(user.getSysDeptId()); // 机构id |
| | | userCore.setOrg_id(1L); |
| | | userCore.setUser_name(user.getUserCode()); //用户账号 |
| | | userCore.setUser_name(user.getUserCode()); // 用户账号 |
| | | userCore.setNick_name(user.getUserName()); |
| | | //用户类型 先默认设置为2 |
| | | // 用户类型 先默认设置为2 |
| | | userCore.setUser_type(2); |
| | | userCore.setPhonenumber(user.getUserPhone()); |
| | | userCore.setSex(user.getSex().toString()); |
| | | //初始化密码 123456 |
| | | // 初始化密码 123456 |
| | | String pws = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); |
| | | userCore.setPassword(pws); |
| | | // 平台用户表和系统用户 表状态相反 |
| | |
| | | userCore.setIs_logoff(0); |
| | | userCore.setLogoff_time(0L); |
| | | userCore.setIs_sms(0); |
| | | //管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | // 管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | userCore.setType(1); |
| | | //商户id,0-平台 |
| | | // 商户id,0-平台 |
| | | userCore.setMer_id(0L); |
| | | sUserCores.add(userCore); |
| | | } |
| | | //保存用户信息 |
| | | // 保存用户信息 |
| | | this.finSysTenantUserService.insertBatch(finSysTenantUsers); |
| | | //保存平台用户信息 |
| | | // 保存平台用户信息 |
| | | this.userService.insertBatch(sUserCores); |
| | | //保存角色权限信息 |
| | | // 保存角色权限信息 |
| | | this.finSysTenantUserService.execInsertRoleUserList(finSysTenantUsers); |
| | | } |
| | | |
| | |
| | | super(message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 编辑 |
| | |
| | | encPhone = AESUtils.encryptStrAES(user.getUserPhone(), key); |
| | | } |
| | | user.setUserPhone(encPhone); |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER |
| | | finSysTenantUserService.update(user); |
| | | // 2.更新平台用户 S_USER_CORE |
| | | // 2.更新平台用户 S_USER_CORE |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(user.getSysUserId()); |
| | | userCore.setUpdate_by(this.getCurrentUser().getUser_name()); |
| | |
| | | // 加密手机号 |
| | | userCore.setPhonenumber(user.getUserPhone()); |
| | | this.userService.update(userCore); |
| | | // 3. 更新角色配置 S_ROLE_USER |
| | | // 1. 根据 user.getSysUserId() 查询 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(user.getSysUserId()); //已有的权限 |
| | | List<Long> roleList = user.getRoleList(); //选择的权限 |
| | | //先删除再添加 |
| | | // 3. 更新角色配置 S_ROLE_USER |
| | | // 1. 根据 user.getSysUserId() 查询 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(user.getSysUserId()); // 已有的权限 |
| | | List<Long> roleList = user.getRoleList(); // 选择的权限 |
| | | // 先删除再添加 |
| | | if (list != null && list.size() > 0) { |
| | | finSysTenantUserService.execDelRoleUserList(user.getSysUserId()); |
| | | } |
| | |
| | | if (user == null) { |
| | | return ResponseValue.error("参数为空"); |
| | | } |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER 应该是查询 然后只改状态 |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER 应该是查询 然后只改状态 |
| | | List<FinSysTenantUser> select = finSysTenantUserService.select(new FinSysTenantUser(user.getId())); |
| | | if (select == null || select.size() == 0) { |
| | | return ResponseValue.error("用户不存在"); |
| | |
| | | FinSysTenantUser finSysTenantUser = select.get(0); |
| | | finSysTenantUser.setStatus(user.getStatus()); |
| | | finSysTenantUserService.update(finSysTenantUser); |
| | | // 2.更新平台用户 S_USER_CORE |
| | | // 2.更新平台用户 S_USER_CORE |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(user.getSysUserId()); |
| | | userCore.setUpdate_by(this.getCurrentUser().getUser_name()); |
| | |
| | | if (finSysTenantUser == null) { |
| | | return ResponseValue.error("用户信息不存在"); |
| | | } |
| | | //初始化密码 123456 |
| | | // 初始化密码 123456 |
| | | String stringValue = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue();// 密文 |
| | | // 1. 修改用户表 |
| | | //用户表id |
| | | // 用户表id |
| | | Long sysUserId = finSysTenantUser.getSysUserId(); |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(sysUserId); |
| | |
| | | } |
| | | |
| | | // 查询 用户角色 TODO 临时解决 将来放配置文件中 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(sysInfo.getSysUserId()); //已有的权限 |
| | | // 已有的权限 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(sysInfo.getSysUserId()); |
| | | for (S_role s_role : list) { |
| | | if (s_role.getRole_id() != null && s_role.getRole_id().equals(1690961420053L)) { |
| | | sysInfo.setKfStatus(1); |
| | | } |
| | | } |
| | | |
| | | // 查询父类的orgcode 需要将自己的org先查出来 再根据parentid 查父类 |
| | | // 查询父类的orgcode 需要将自己的org先查出来 再根据parentid 查父类 |
| | | String tenantId = sysInfo.getTenantId(); |
| | | if (tenantId != null && !tenantId.equals("")) { |
| | | List<FinSysTenant> select = finSysTenantService.select(new FinSysTenant(Long.valueOf(tenantId))); |
| | | if (select != null && select.size() > 0) { |
| | | FinSysTenant finSysTenant = select.get(0); |
| | | if (finSysTenant != null && finSysTenant.getParentId() != null) { |
| | | List<FinSysTenant> parents = finSysTenantService.select(new FinSysTenant(finSysTenant.getParentId())); |
| | | List<FinSysTenant> parents = |
| | | finSysTenantService.select(new FinSysTenant(finSysTenant.getParentId())); |
| | | if (parents != null && parents.size() > 0) { |
| | | sysInfo.setParentCode(parents.get(0).getCode()); |
| | | } |
| | |
| | | } |
| | | return ResponseValue.success(sysInfo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新角色权限 |
| | |
| | | if (user == null) { |
| | | return ResponseValue.error("参数为空"); |
| | | } |
| | | // 1. 根据 user.getSysUserId() 查询 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(user.getSysUserId()); //已有的权限 |
| | | List<Long> roleList = user.getRoleList(); //选择的权限 |
| | | //先删除再添加 |
| | | // 1. 根据 user.getSysUserId() 查询 |
| | | List<S_role> list = finSysTenantUserService.getByUserId(user.getSysUserId()); // 已有的权限 |
| | | List<Long> roleList = user.getRoleList(); // 选择的权限 |
| | | // 先删除再添加 |
| | | if (list != null && list.size() > 0) { |
| | | finSysTenantUserService.execDelRoleUserList(user.getSysUserId()); |
| | | } |
| | |
| | | } |
| | | return ResponseValue.success(1); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | if (depts == null || depts.size() == 0) { |
| | | return ResponseValue.error(roleName + "的角色不存在"); |
| | | } |
| | | //根据员工编号查询,如果存在则提示 |
| | | if (finSysTenantUserService.getByUserCode(user.getUserCode()) != null && finSysTenantUserService.getByUserCode(user.getUserCode()) > 0) { |
| | | // 根据员工编号查询,如果存在则提示 |
| | | if (finSysTenantUserService.getByUserCode(user.getUserCode()) != null |
| | | && finSysTenantUserService.getByUserCode(user.getUserCode()) > 0) { |
| | | return ResponseValue.error("员工编号重复"); |
| | | } |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | //插入系统用户 |
| | | // 插入系统用户 |
| | | user.setId(NumberGenerator.getLongSequenceNumber()); |
| | | user.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | user.setCreateBy(this.getCurrentUser().getUser_name()); |
| | |
| | | user.setLv(sysInfo.getLv()); |
| | | user.setTenantCode(sysInfo.getTenantCode()); |
| | | user.setTenantId(sysInfo.getTenantId()); |
| | | user.setSysDeptId(2l); //运维管理 |
| | | user.setSysDeptId(2l); // 运维管理 |
| | | // 加密手机号 |
| | | String key = PlatformRSAUtils.AES_KEY; |
| | | String userPhone = user.getUserPhone(); |
| | |
| | | // 插入平台用户 |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(user.getSysUserId()); |
| | | userCore.setDept_id(depts.get(0).getId()); //部门 |
| | | userCore.setDept_id(depts.get(0).getId()); // 部门 |
| | | userCore.setOrg_id(1L); |
| | | //userCore.setUser_name(); //用户账号 |
| | | userCore.setUser_name(user.getUserCode()); //用户账号 |
| | | // userCore.setUser_name(); //用户账号 |
| | | userCore.setUser_name(user.getUserCode()); // 用户账号 |
| | | userCore.setNick_name(user.getUserName()); |
| | | //用户类型 先默认设置为2 |
| | | // 用户类型 先默认设置为2 |
| | | userCore.setUser_type(2); |
| | | |
| | | userCore.setPhonenumber(userPhone); |
| | | //初始化密码 123456 |
| | | // 初始化密码 123456 |
| | | String pws = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); |
| | | userCore.setPassword(pws); |
| | | if (user.getStatus() == 0) { |
| | |
| | | userCore.setIs_logoff(0); |
| | | userCore.setLogoff_time(0L); |
| | | userCore.setIs_sms(0); |
| | | //管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | // 管理员类型:1= 平台超管, 2=商户超管, 3=系统管理员,4=商户管理员 |
| | | userCore.setType(2); |
| | | //商户id,0-平台 |
| | | // 商户id,0-平台 |
| | | userCore.setMer_id(0L); |
| | | this.userService.insert(userCore); |
| | | // 插入平台机构 |
| | | //少角色id |
| | | List<Long> roleList = user.getRoleList(); //机构id 多个 |
| | | Long sysUserId = user.getSysUserId(); //用户id |
| | | // 少角色id |
| | | List<Long> roleList = user.getRoleList(); // 机构id 多个 |
| | | Long sysUserId = user.getSysUserId(); // 用户id |
| | | this.finSysTenantUserService.execInsertRoleUserList(roleList, sysUserId); |
| | | return ResponseValue.success(1); |
| | | } |
| | | |
| | | private Set<String> picFormatArr = new HashSet<String>() {{ |
| | | add(".pjp"); |
| | | add(".svgz"); |
| | | add(".jxl"); |
| | | add(".jpeg"); |
| | | add(".ico"); |
| | | add(".avif"); |
| | | add(".tif"); |
| | | add(".gif"); |
| | | add(".jfif"); |
| | | add(".jpg"); |
| | | add(".svg"); |
| | | add(".png"); |
| | | add(".xbm"); |
| | | add(".pjpeg"); |
| | | add(".bmp"); |
| | | add(".webp"); |
| | | }}; |
| | | private Set<String> picFormatArr = new HashSet<String>() { |
| | | { |
| | | add(".pjp"); |
| | | add(".svgz"); |
| | | add(".jxl"); |
| | | add(".jpeg"); |
| | | add(".ico"); |
| | | add(".avif"); |
| | | add(".tif"); |
| | | add(".gif"); |
| | | add(".jfif"); |
| | | add(".jpg"); |
| | | add(".svg"); |
| | | add(".png"); |
| | | add(".xbm"); |
| | | add(".pjpeg"); |
| | | add(".bmp"); |
| | | add(".webp"); |
| | | } |
| | | }; |
| | | |
| | | @PostMapping("/updatePerson") |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | encPhone = AESUtils.encryptStrAES(user.getUserPhone(), key); |
| | | } |
| | | updUser.setUserPhone(encPhone); |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER |
| | | // 1.更新系统用户 FIN_SYS_TENANT_USER |
| | | finSysTenantUserService.update(updUser); |
| | | // 2.更新平台用户 S_USER_CORE |
| | | // 2.更新平台用户 S_USER_CORE |
| | | S_user_core userCore = new S_user_core(); |
| | | userCore.setId(sysInfo.getSysUserId()); |
| | | userCore.setUpdate_by(this.getCurrentUser().getUser_name()); |
| | |
| | | String oldMixPd = param.getOldMixPd(); |
| | | String newMixPd = param.getNewMixPd(); |
| | | String btnMixPd = param.getBtnMixPd(); |
| | | //校验参数 |
| | | // 校验参数 |
| | | if (StringUtils.isEmpty(oldMixPd) || StringUtils.isEmpty(newMixPd) || StringUtils.isEmpty(btnMixPd)) { |
| | | return ResponseValue.error("信息不能为空!"); |
| | | } |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("用户信息不存在"); |
| | | } |
| | | //校验俩次输入的密码 |
| | | // 校验俩次输入的密码 |
| | | btnMixPd = PlatformRSAUtils.getRsaDecryptValue(btnMixPd, PlatformRSAUtils.PRIK); |
| | | newMixPd = PlatformRSAUtils.getRsaDecryptValue(newMixPd, PlatformRSAUtils.PRIK); |
| | | if (!newMixPd.equals(btnMixPd)) { |
| | |
| | | if (validatePasswordRule != null) { |
| | | return ResponseValue.error(validatePasswordRule); |
| | | } |
| | | //用户表id |
| | | // 用户表id |
| | | Long sysUserId = sysInfo.getSysUserId(); |
| | | S_user_core queryU = new S_user_core(); |
| | | queryU.setId(sysUserId); |
| | |
| | | return ResponseValue.error("用户信息不存在"); |
| | | } |
| | | oldMixPd = PlatformRSAUtils.getRsaDecryptValue(oldMixPd, PlatformRSAUtils.PRIK); |
| | | //校验老密码 |
| | | // 校验老密码 |
| | | if (!this.matchesPassword(oldMixPd, queryUserInfo.getPassword())) { |
| | | return ResponseValue.error("旧密码输入有误!"); |
| | | } |
| | | if (oldMixPd.equalsIgnoreCase(btnMixPd)) { |
| | | return ResponseValue.error("新密码不能与旧密码相同!"); |
| | | } |
| | | //更新数据库 |
| | | // 更新数据库 |
| | | // 1. 修改用户表 |
| | | queryU.setPassword(this.encryptPassword(btnMixPd)); |
| | | queryU.setModify_pwd(1); |
| | |
| | | |
| | | @ApiOperation(value = "根据机构id查询部门中的用户", notes = "根据机构id查询部门中的用户") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/select/department") |
| | | public ResponseValue selectDepartment(Long agencyId) { |
| | | FinSysTenantVO finSysTenantVO = new FinSysTenantVO(); |
| | |
| | | // 部门 |
| | | FinSysTenantDepartment finSysTenantDepartment = new FinSysTenantDepartment(); |
| | | finSysTenantDepartment.setTenantId(agencyId); |
| | | List<FinSysTenantDepartment> tenantDepartmentList = finSysTenantDepartmentService.select(finSysTenantDepartment); |
| | | List<FinSysTenantDepartment> tenantDepartmentList = |
| | | finSysTenantDepartmentService.select(finSysTenantDepartment); |
| | | List<DepartmentVO> departmentVOList = Lists.newArrayList(); |
| | | tenantDepartmentList.forEach(department -> { |
| | | DepartmentVO departmentVO = new DepartmentVO(); |
| | | //用户 |
| | | // 用户 |
| | | Long id = department.getId(); |
| | | departmentVO.setId(id); |
| | | departmentVO.setName(department.getName()); |
| | | departmentVO.setType("department"); |
| | | |
| | | String sql = "SELECT SYS_USER_ID,USER_NAME FROM " |
| | | + "fin_sys_tenant_user " |
| | | String sql = "SELECT SYS_USER_ID,USER_NAME FROM " + "fin_sys_tenant_user " |
| | | + "WHERE SYS_DEPT_ID =:deptId AND SYS_USER_ID NOT IN(SELECT MANAGER_ID FROM base_warehouse_manager)"; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("deptId", id); |
| | |
| | | List<UserVO> userVOList = Lists.newArrayList(); |
| | | select.forEach(user -> { |
| | | UserVO userVO = new UserVO(); |
| | | userVO.setId((Long) user.get("sysUserId")); |
| | | userVO.setId((Long)user.get("sysUserId")); |
| | | userVO.setName(user.get("userName").toString()); |
| | | userVO.setType("user"); |
| | | userVOList.add(userVO); |
| | |
| | | |
| | | return ResponseValue.success(finSysTenantVO); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.pojo.response.FormOutputGoodsVO; |
| | | import com.consum.base.pojo.response.FormOutputTemplateInfoVO; |
| | | import com.consum.base.pojo.response.FormOutputVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWhFormOutputExtendVO; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhFormOutputServiceImpl; |
| | |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | |
| | | * @Date 2023/10/27 |
| | | */ |
| | | @ApiOperation(value = "新增出库单", notes = "新增出库单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "出库单实体", dataType = "lWhFormOutputParam", dataTypeClass = LWhFormOutputParam.class, paramType = "body") |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "出库单实体", dataType = "lWhFormOutputParam", |
| | | dataTypeClass = LWhFormOutputParam.class, paramType = "body")}) |
| | | @PostMapping("/add") |
| | | public ResponseValue add() { |
| | | LWhFormOutputParam param = CommonUtil.getObjFromReqBody(LWhFormOutputParam.class); |
| | |
| | | * @Description 列表查询 |
| | | */ |
| | | @ApiOperation(value = "列表查询", notes = "列表查询") |
| | | @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputParam", paramType = "query") |
| | | @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputParam", |
| | | paramType = "query") |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormOutputList() { |
| | | LWhFormOutputQry param = CommonUtil.getObjFromReq(LWhFormOutputQry.class); |
| | |
| | | List<FormOutputVO> resultList = Lists.newArrayList(); |
| | | if (!CollectionUtils.isEmpty(data)) { |
| | | data.forEach(item -> { |
| | | // 查询型号数量 |
| | | FormOutputVO formOutputVO = new FormOutputVO(); |
| | | BeanUtils.copyProperties(item, formOutputVO); |
| | | |
| | | List<FormOutputTemplateInfoVO> procureTemplateInfoList = Lists.newArrayList(); |
| | | |
| | | // 查询型号数量 |
| | | String sql = "SELECT bgt.id,bgm.GOODS_TEMPLATES_ID,GOODS_NAME,sum( counts ) count FROM " |
| | | + "l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id " |
| | | + "LEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id " |
| | | + "WHERE pm.BUSINESS_ID =:id GROUP BY bgm.GOODS_TEMPLATES_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FormOutputTemplateInfoVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FormOutputTemplateInfoVO.class); |
| | | procureTemplateInfoList.add(procureTemplateInfoVO); |
| | | } |
| | | formOutputVO.setFormOutputTemplateInfoList(procureTemplateInfoList); |
| | | // 查询物品型号统计数量 |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = |
| | | lWhProcureModelService.getGoodsTemplateCountByBusinessId(item.getId()); |
| | | formOutputVO.setFormOutputTemplateInfoList(goodsTemplateCount); |
| | | |
| | | resultList.add(formOutputVO); |
| | | }); |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, resultList); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, resultList); |
| | | ReflectUtil.setFieldValue(genericPager, fieldDatas, resultList); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.error("查询出库单列表失败", e); |
| | | } |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | |
| | | List<GoodsModelVO> goodsModelVOList = Lists.newArrayList(); |
| | | String sql2 = "SELECT pm.id,pm.BASE_GOODS_MODELS_NAME,bgm.UNIT,COUNTS,total_amount " |
| | | + "FROM l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " |
| | | + "WHERE pm.BUSINESS_ID =:id"; |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " + "WHERE pm.BUSINESS_ID =:id"; |
| | | List<Map<String, Object>> modelList = lWhFormOutputService.select(sql2, paramMap, new MapperUtil()); |
| | | modelList.forEach(item -> { |
| | | GoodsModelVO goodsModelVO = MapUtils.convertMapToObj(item, GoodsModelVO.class); |
| | |
| | | return ResponseValue.success("查询成功!", lWhFormOutputExtendVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询出库单详情明细", notes = "查询出库单详情明细") |
| | | @ApiImplicitParam(name = "formOutputQry", value = "出库单详情查询条件", required = true, dataType = "LWhFormOutputQry", paramType = "query") |
| | | @ApiImplicitParam(name = "formOutputQry", value = "出库单详情查询条件", required = true, dataType = "LWhFormOutputQry", |
| | | paramType = "query") |
| | | @GetMapping("/detail/list") |
| | | public ResponseValue queryFormOutputDetailList() { |
| | | LWhFormOutputQry formOutputQry = CommonUtil.getObjFromReq(LWhFormOutputQry.class); |
| | |
| | | PageUtil genericPager = lWarehouseFlowService.queryAllBusinessFlow(formOutputQry); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "出库单导出", notes = "出库单导出") |
| | | @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query") |
| | |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | | throw new RuntimeException("数据为空"); |
| | | } |
| | | int countNum = exportList.stream().filter(item -> item.getNum() != null).mapToInt(OutputExcelTemplate::getNum).sum(); |
| | | double totalAmount = exportList.stream().filter(item -> item.getTotalAmount() != null).mapToDouble(OutputExcelTemplate::getAmount).sum(); |
| | | int countNum = |
| | | exportList.stream().filter(item -> item.getNum() != null).mapToInt(OutputExcelTemplate::getNum).sum(); |
| | | double totalAmount = exportList.stream().filter(item -> item.getTotalAmount() != null) |
| | | .mapToDouble(OutputExcelTemplate::getAmount).sum(); |
| | | Optional<OutputExcelTemplate> first = exportList.stream().findFirst(); |
| | | OutputExcelTemplate templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.pojo.response.FormProcureVO; |
| | | import com.consum.base.pojo.response.FromProcureTemplateInfoVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureGoodsVO; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LOrgSupplierServiceImpl; |
| | | import com.consum.base.service.LWhFormProcureCoreService; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LOrgSupplier; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.pojo.response.FormProcureVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureGoodsVO; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.LWhFormProcureCoreService; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureController |
| | |
| | | @Resource |
| | | private LWhFormProcureService lWhFormProcureService; |
| | | @Resource |
| | | private BaseWarehouseService baseWarehouseService; |
| | | @Resource |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Resource |
| | | private LWhFormProcureGoodsService lWhFormProcureGoodsService; |
| | | private LWhFormProcureGoodsService lWhFormProcureGoodsServiceImpl; |
| | | @Resource |
| | | private LWhFormProcureCoreService lWhFormProcureCoreService; |
| | | @Resource |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Resource |
| | | private BaseGoodsTemplateService baseGoodsTemplateService; |
| | | @Resource |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Resource |
| | | private LOrgSupplierServiceImpl lOrgSupplierService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | } |
| | | |
| | | private ResponseValue add(LWhFormProcureParam param) { |
| | | Long warehouseId = param.getWarehouseId(); |
| | | if (param.getWarehouseId() == null) { |
| | | return ResponseValue.error("仓库ID不能为空"); |
| | | } |
| | | BaseWarehouse baseWarehouse = baseWarehouseService.getById(warehouseId); |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String tenantId = sysTenantUser.getTenantId(); |
| | | String tenantName = sysTenantUser.getTenantName(); |
| | | |
| | | List<LWhFormProcureGoodsInfoParam> procureGoods = param.getProcureGoods(); |
| | | if (CollectionUtils.isEmpty(procureGoods)) { |
| | | return ResponseValue.error("采购单不能为空"); |
| | | } |
| | | |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | // 采购单id |
| | | Long whFormProcureId = param.getId(); |
| | | if (whFormProcureId == null) { |
| | | whFormProcureId = IdUtil.generateId(); |
| | | } |
| | | long procureTime = Long.valueOf(param.getProcureTime()); |
| | | |
| | | Set<String> supplierList = new HashSet<>(); |
| | | |
| | | ArrayList<LWhFormProcureGoods> procureGoodList = new ArrayList<>(); |
| | | ArrayList<LWhProcureModel> procureModelList = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < procureGoods.size(); i++) { |
| | | LWhFormProcureGoodsInfoParam procureGoodT = procureGoods.get(i); |
| | | Long baseCategoryId = procureGoodT.getBaseCategoryId(); |
| | | Long baseGoodsTemplateId = procureGoodT.getBaseGoodsTemplateId(); |
| | | String supplier = procureGoodT.getSupplier(); |
| | | // 判断当前供应商是否已存在 |
| | | if (!supplierList.contains(supplier) && !lOrgSupplierService.supplierIsContain(tenantId, supplier)) { |
| | | supplierList.add(supplier); |
| | | } |
| | | |
| | | List<LWhProcureModelParam> models = procureGoodT.getModels(); |
| | | if (CollectionUtils.isEmpty(models)) { |
| | | return ResponseValue.error("采购单不能为空"); |
| | | } |
| | | LWhFormProcureGoods procureGood = new LWhFormProcureGoods(); |
| | | long fromProcureGoodsId = IdUtil.generateId(); |
| | | procureGood.setId(fromProcureGoodsId); |
| | | procureGood.setWhFormProcureId(whFormProcureId); |
| | | procureGood.setBaseCategoryId(baseCategoryId); |
| | | procureGood.setBaseGoodsTemplateId(baseGoodsTemplateId); |
| | | // TODO 物品历史版本 |
| | | procureGood.setGoodsTemplateName(procureGoodT.getGoodsTemplateName()); |
| | | procureGood.setSupplier(supplier); |
| | | procureGood.setSort(i); |
| | | for (LWhProcureModelParam modelT : models) { |
| | | Integer counts = modelT.getCounts(); |
| | | if (counts == null || counts <= 0) { |
| | | return ResponseValue.error("型号的采购数量只能为正整数"); |
| | | } |
| | | Long price = modelT.getPrice(); |
| | | if (price == null || price <= 0) { |
| | | return ResponseValue.error("型号的采购价格只能为正数"); |
| | | } |
| | | Long baseGoodsModelsId = modelT.getBaseGoodsModelsId(); |
| | | if (baseGoodsModelsId == null) { |
| | | return ResponseValue.error("采购的价型号未找到"); |
| | | } |
| | | //查询型号信息 |
| | | Map<String, Object> tempGoodsInfo = baseGoodsTemplateService.queryGoodsInfoByModelId(baseGoodsModelsId); |
| | | if (tempGoodsInfo == null) { |
| | | return ResponseValue.error("采购的价型号未找到"); |
| | | } |
| | | String modelName = (String) tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(IdUtil.generateId()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | model.setBusinessId(whFormProcureId); |
| | | model.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | model.setBaseGoodsModelsName(modelName); |
| | | model.setPrice(price); |
| | | model.setCounts(counts); |
| | | model.setWorehouseCount(goodsModelNum); |
| | | model.setSupplier(supplier); |
| | | model.setTotalAmount(price * counts); |
| | | procureModelList.add(model); |
| | | } |
| | | procureGoodList.add(procureGood); |
| | | } |
| | | lWhFormProcureGoodsService.insertBatch(procureGoodList); |
| | | lWhProcureModelService.insertBatch(procureModelList); |
| | | |
| | | // 插入 采购单物品【L_WH_FORM_PROCURE_GOODS】 |
| | | LWhFormProcure lWhFormProcure = new LWhFormProcure(); |
| | | lWhFormProcure.setId(whFormProcureId); |
| | | lWhFormProcure.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Procure_Warehouse)); |
| | | lWhFormProcure.setWarehouseId(warehouseId); |
| | | lWhFormProcure.setWarehouseName(baseWarehouse.getWarehouseName()); |
| | | lWhFormProcure.setBuyerId(currentUser.getId()); |
| | | lWhFormProcure.setBuyerName(currentUser.getNick_name()); |
| | | lWhFormProcure.setProcureTime(procureTime); |
| | | lWhFormProcure.setProcureDoc(param.getProcureDoc()); |
| | | lWhFormProcure.setBuyType(param.getBuyType()); |
| | | lWhFormProcure.setStates(1); |
| | | lWhFormProcure.setAgencyId(baseWarehouse.getAgencyId()); |
| | | lWhFormProcure.setAgencyName(baseWarehouse.getAgencyName()); |
| | | int result = lWhFormProcureService.insert(lWhFormProcure); |
| | | |
| | | supplierList.forEach(supplier -> { |
| | | LOrgSupplier lOrgSupplier = new LOrgSupplier(); |
| | | lOrgSupplier.setId(IdUtil.generateId()); |
| | | lOrgSupplier.setAgencyId(tenantId); |
| | | lOrgSupplier.setAgencyName(tenantName); |
| | | lOrgSupplier.setSupplier(supplier); |
| | | lOrgSupplierService.insert(lOrgSupplier); |
| | | }); |
| | | if (result > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | | return ResponseValue.error("新增失败!"); |
| | | lWhFormProcureService.add(param, sysTenantUser, currentUser); |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | */ |
| | | @ApiOperation(value = "采购单列表查询", notes = "采购单列表查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "采购查询条件", required = true, dataType = "FormProcureQryDto", paramType = "query") |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "采购查询条件", required = true, |
| | | dataType = "FormProcureQryDto", paramType = "query")}) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormProcureList() { |
| | | FormProcureQry param = CommonUtil.getObjFromReq(FormProcureQry.class); |
| | |
| | | ArrayList<FormProcureVO> result = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(data)) { |
| | | data.forEach(item -> { |
| | | |
| | | FormProcureVO fromProcureVO = new FormProcureVO(); |
| | | BeanUtils.copyProperties(item, fromProcureVO); |
| | | List<FromProcureTemplateInfoVO> procureTemplateInfoList = Lists.newArrayList(); |
| | | |
| | | // 查询型号数量 |
| | | String sql = "select fpg.id,BASE_CATEGORY_ID ,BASE_GOODS_TEMPLATE_ID ,GOODS_TEMPLATE_NAME ,sum(counts) count " |
| | | + "from L_WH_FORM_PROCURE_GOODS fpg left join L_WH_PROCURE_MODEL pm on fpg.id = pm.FROM_PROCURE_GOODS_ID " |
| | | + "where fpg.WH_FORM_PROCURE_ID =:id group by pm.FROM_PROCURE_GOODS_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FromProcureTemplateInfoVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FromProcureTemplateInfoVO.class); |
| | | procureTemplateInfoList.add(procureTemplateInfoVO); |
| | | } |
| | | fromProcureVO.setFromProcureTemplateInfoList(procureTemplateInfoList); |
| | | List<GoodsTemplateCountVO> procureCount = |
| | | lWhProcureModelService.getProcureCountByBusinessId(item.getId()); |
| | | fromProcureVO.setFromProcureTemplateInfoList(procureCount); |
| | | |
| | | result.add(fromProcureVO); |
| | | }); |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | ReflectUtil.setFieldValue(genericPager, fieldDatas, result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | if (num == 0) { |
| | | return ResponseValue.error("删除失败!"); |
| | | } |
| | | lWhFormProcureGoodsService.update("delete from L_WH_FORM_PROCURE_GOODS where WH_FORM_PROCURE_ID=" + id); |
| | | lWhFormProcureGoodsServiceImpl.update("delete from L_WH_FORM_PROCURE_GOODS where WH_FORM_PROCURE_ID=" + id); |
| | | |
| | | lWhProcureModelService.update("delete from L_WH_PROCURE_MODEL where BUSINESS_TYPE =1 and BUSINESS_ID=" + id); |
| | | return ResponseValue.success(1); |
| | |
| | | // 物品 |
| | | LWhFormProcureGoods lWhFormProcureGoods = new LWhFormProcureGoods(); |
| | | lWhFormProcureGoods.setWhFormProcureId(id); |
| | | List<LWhFormProcureGoods> formProcureGoods = lWhFormProcureGoodsService.select(lWhFormProcureGoods); |
| | | List<LWhFormProcureGoods> formProcureGoods = lWhFormProcureGoodsServiceImpl.select(lWhFormProcureGoods); |
| | | |
| | | // Field fieldModels = null; |
| | | // try { |
| | | // fieldModels = LWhFormProcureGoodsVO.class.getDeclaredField("models"); |
| | | // } catch (NoSuchFieldException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // fieldModels.setAccessible(true); |
| | | // Field fieldModels = null; |
| | | // try { |
| | | // fieldModels = LWhFormProcureGoodsVO.class.getDeclaredField("models"); |
| | | // } catch (NoSuchFieldException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // fieldModels.setAccessible(true); |
| | | ArrayList<LWhFormProcureGoodsVO> procureGoodsVOList = new ArrayList<>(); |
| | | for (LWhFormProcureGoods formProcureGood : formProcureGoods) { |
| | | LWhFormProcureGoodsVO lWhFormProcureGoodsVO = new LWhFormProcureGoodsVO(); |
| | |
| | | // 查询型号数量 |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("formProcureGoodId", formProcureGood.getId()); |
| | | String sql = "SELECT\n" + "pm.BASE_GOODS_MODELS_ID,pm.BASE_GOODS_MODELS_NAME,pm.PRICE,pm.COUNTS,pm.WOREHOUSE_COUNT,bgm.unit " + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | String sql = "SELECT\n" |
| | | + "pm.BASE_GOODS_MODELS_ID,pm.BASE_GOODS_MODELS_NAME,pm.PRICE,pm.COUNTS,pm.WOREHOUSE_COUNT,bgm.unit " |
| | | + "FROM\n" + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm on pm.BASE_GOODS_MODELS_ID = bgm.id where pm.FROM_PROCURE_GOODS_ID =:formProcureGoodId"; |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | List<GoodsModelVO> goodsModelVOList = Lists.newArrayList(); |
| | |
| | | GoodsModelVO goodsModelVO = MapUtils.convertMapToObj(item, GoodsModelVO.class); |
| | | goodsModelVOList.add(goodsModelVO); |
| | | }); |
| | | // fieldModels.set(lWhFormProcureGoodsVO, goodsModelVOList); |
| | | // fieldModels.set(lWhFormProcureGoodsVO, goodsModelVOList); |
| | | ReflectUtil.setFieldValue(lWhFormProcureGoodsVO, "models", goodsModelVOList); |
| | | |
| | | procureGoodsVOList.add(lWhFormProcureGoodsVO); |
| | |
| | | return ResponseValue.success("查询成功!", lWhFormProcureExtendVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "采购单明细查询", notes = "采购单明细查询") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "采购单明细查询", required = true, dataType = "FormProcureQryDto", paramType = "query")}) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "采购单明细查询", required = true, |
| | | dataType = "FormProcureQryDto", paramType = "query")}) |
| | | @GetMapping("detail/list") |
| | | public ResponseValue queryFormProcureDetailList() { |
| | | FormProcureQry formProcureQry = CommonUtil.getObjFromReq(FormProcureQry.class); |
| | |
| | | |
| | | @ApiOperation(value = "采购单导出", notes = "采购单导出") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "采购单id", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | @ApiImplicitParam(name = "id", value = "采购单id", required = true, dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/采购入库单.xls"); |
| | | TemplateExportParams params = new TemplateExportParams("import/采购入库单.xls"); |
| | | params.setHeadingStartRow(2); |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | if (sysInfo == null) { |
| | |
| | | throw new RuntimeException("数据为空"); |
| | | } |
| | | |
| | | int countNum = exportList.stream().filter(item -> item.getNum() != null).mapToInt(ProcureExcelTemplate::getNum).sum(); |
| | | double totalAmount = exportList.stream().filter(export -> export.getTotalAmount() != null).mapToDouble(ProcureExcelTemplate::getAmount).sum(); |
| | | int countNum = |
| | | exportList.stream().filter(item -> item.getNum() != null).mapToInt(ProcureExcelTemplate::getNum).sum(); |
| | | double totalAmount = exportList.stream().filter(export -> export.getTotalAmount() != null) |
| | | .mapToDouble(ProcureExcelTemplate::getAmount).sum(); |
| | | Optional<ProcureExcelTemplate> first = exportList.stream().findFirst(); |
| | | ProcureExcelTemplate templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.FromTransferTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedVO; |
| | | import com.consum.base.service.LWhFormScrappedServiceImpl; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedVO; |
| | | import com.consum.base.service.LWhFormScrappedService; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormScrapped; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | |
| | | public class LWhFormScrappedController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LWhFormScrappedServiceImpl lWhFormScrappedService; |
| | | |
| | | private LWhFormScrappedService lWhFormScrappedService; |
| | | |
| | | /** |
| | | * @Description 新增报废单 |
| | |
| | | * @Date 2023/11/1 |
| | | */ |
| | | @ApiOperation(value = "新增报废单", notes = "新增报废单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param") |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param")}) |
| | | @PostMapping("/add") |
| | | public ResponseValue add() { |
| | | LWhFormScrappedParam param = CommonUtil.getObjFromReqBody(LWhFormScrappedParam.class); |
| | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/02 1.查询报废单 2.查询报废单物品 |
| | | * @Date 2023/11/02 |
| | | * <p> |
| | | * </>1.查询报废单 2.查询报废单物品 |
| | | */ |
| | | @ApiOperation(value = "列表查询", notes = "列表查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query") |
| | | }) |
| | | @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query")}) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryList() { |
| | | LWhFormScrappedQry param = CommonUtil.getObjFromReq(LWhFormScrappedQry.class); |
| | |
| | | data.forEach(item -> { |
| | | LWhFormScrappedVO lWhFormScrappedVO = new LWhFormScrappedVO(); |
| | | BeanUtils.copyProperties(item, lWhFormScrappedVO); |
| | | List<FromTransferTemplateInfoVO> list = Lists.newArrayList(); |
| | | // 查询型号数量 |
| | | String sql = |
| | | "SELECT fsg.id,fsg.BASE_GOODS_TEMPLATE_ID goodsTemplatesId,fsg.GOODS_TEMPLATE_NAME goodsName,sum(counts) count FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID " |
| | | + "where fsg.FORM_SCRAPPED_ID =:id group by fsg.BASE_GOODS_TEMPLATE_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhFormScrappedService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FromTransferTemplateInfoVO fromTransferTemplateInfoVO = MapUtils.convertMapToObj(map, FromTransferTemplateInfoVO.class); |
| | | list.add(fromTransferTemplateInfoVO); |
| | | } |
| | | lWhFormScrappedVO.setGoodTemplateInfo(list); |
| | | List<GoodsTemplateCountVO> scrappedCount = |
| | | lWhFormScrappedService.getScrappedCountByBusinessId(item.getId()); |
| | | lWhFormScrappedVO.setGoodTemplateInfo(scrappedCount); |
| | | result.add(lWhFormScrappedVO); |
| | | }); |
| | | } |
| | |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query") |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id) { |
| | | if (id == null) { |
| | |
| | | */ |
| | | @ApiOperation(value = "报废明细", notes = "报废明细") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query") |
| | | }) |
| | | @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query")}) |
| | | @GetMapping("/list/detailList") |
| | | public ResponseValue queryDetailList() { |
| | | LWhFormScrappedQry param = CommonUtil.getObjFromReq(LWhFormScrappedQry.class); |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "导出报废单", notes = "导出报废单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query") |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | if (id == null) { |
| | |
| | | String operatorName = scrappedInfoExcelTemplate.getOperatorName(); |
| | | String businessFormCode = scrappedInfoExcelTemplate.getBusinessFormCode(); |
| | | |
| | | int countNum = export.stream().filter(item -> item.getNum() != null).mapToInt(ScrappedInfoExcelTemplate::getNum).sum(); |
| | | int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null).mapToInt(ScrappedInfoExcelTemplate::getTotalAmount).sum(); |
| | | int countNum = |
| | | export.stream().filter(item -> item.getNum() != null).mapToInt(ScrappedInfoExcelTemplate::getNum).sum(); |
| | | int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null) |
| | | .mapToInt(ScrappedInfoExcelTemplate::getTotalAmount).sum(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.GoodsUseRecordVO; |
| | | import com.consum.base.pojo.LWhFormTransferGoodsInfoParam; |
| | | import com.consum.base.pojo.RecordUserInfoVO; |
| | |
| | | import com.consum.base.pojo.request.ProcureModelInfoParam; |
| | | import com.consum.base.pojo.request.RecordInfoParam; |
| | | import com.consum.base.pojo.response.FormTransferVO; |
| | | import com.consum.base.pojo.response.FromTransferTemplateInfoVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.base.pojo.response.TransferInfoVO; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LWhFormTransferCoreService; |
| | | import com.consum.base.service.LWhFormTransferService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.base.service.LWhProcureModelUserRecordServiceImpl; |
| | | import com.consum.base.service.LWhProcureModelUserRecordService; |
| | | import com.consum.base.service.LWhProcureModelUserServiceImpl; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description 调拨管理 |
| | |
| | | @Autowired |
| | | private LWhProcureModelUserServiceImpl lWhProcureModelUserService; |
| | | @Autowired |
| | | private LWhProcureModelUserRecordServiceImpl lWhProcureModelUserRecordService; |
| | | private LWhProcureModelUserRecordService lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | |
| | |
| | | long id = this.lWhFormTransferService.add(param, this.getSysInfo()); |
| | | |
| | | Integer transferBusinessType = param.getTransferBusinessType(); |
| | | //部门分发业务需要处理 |
| | | // 部门分发业务需要处理 |
| | | if (transferBusinessType == 1) { |
| | | // 先出库,再入库 |
| | | // 出库前 设置出库仓库 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = baseWarehouseService.getByAgencyId(Long.valueOf(agencyId), (short) 1, (short) 1); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getByAgencyId(Long.valueOf(agencyId), (short)1, (short)1); |
| | | if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | return ResponseValue.error("机构无默认仓库!"); |
| | | } |
| | |
| | | * @Description 列表查询(调拨明细) |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | * <p> |
| | | * 1.查询调拨单 |
| | | * <p> |
| | | * 2.查询物品型号 |
| | | * <p> |
| | | * 1.查询调拨单 |
| | | * <p> |
| | | * 2.查询物品型号 |
| | | */ |
| | | @ApiOperation(value = "单据列表查询", notes = "单据列表查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "int"), |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "param", value = "条件参数", required = true, dataType = "TransferQry"), |
| | | }) |
| | | @ApiImplicitParam(name = "param", value = "条件参数", required = true, dataType = "TransferQry"),}) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormTransferList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | FormTransferVO formTransferVO = new FormTransferVO(); |
| | | BeanUtils.copyProperties(item, formTransferVO); |
| | | |
| | | List<FromTransferTemplateInfoVO> templateInfoList = Lists.newArrayList(); |
| | | |
| | | // 查询型号数量 |
| | | String sql = "SELECT bgt.id,bgm.GOODS_TEMPLATES_ID,GOODS_NAME,sum( counts ) count FROM " |
| | | + "l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id " |
| | | + "LEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id " |
| | | + "WHERE pm.BUSINESS_ID =:id GROUP BY bgm.GOODS_TEMPLATES_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FromTransferTemplateInfoVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FromTransferTemplateInfoVO.class); |
| | | templateInfoList.add(procureTemplateInfoVO); |
| | | } |
| | | formTransferVO.setFromTransferTemplateInfoList(templateInfoList); |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = |
| | | lWhProcureModelService.getGoodsTemplateCountByBusinessId(item.getId()); |
| | | formTransferVO.setFromTransferTemplateInfoList(goodsTemplateCount); |
| | | |
| | | result.add(formTransferVO); |
| | | }); |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | ReflectUtil.setFieldValue(genericPager, fieldDatas, result); |
| | | |
| | | } catch (Exception e) { |
| | |
| | | * @Date 2023/10/30 |
| | | */ |
| | | @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @GetMapping("/detail") |
| | | public ResponseValue getById(Long id) { |
| | | if (id == null) { |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "调拨明细列表", notes = "调拨明细列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "条件", required = true, dataType = "TransferQry"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "条件", required = true, dataType = "TransferQry"),}) |
| | | @GetMapping("/detail/list") |
| | | public ResponseValue queryFormTransferDetailList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | * @date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "撤销", notes = "撤销") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/updStatus") |
| | | public ResponseValue updateStatus(Long id) { |
| | | if (id == null) { |
| | |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨入库", notes = "调拨入库") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/income") |
| | | public ResponseValue income(Long id) { |
| | | lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser()); |
| | |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @ApiOperation(value = "调拨出库", notes = "调拨出库") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"),}) |
| | | @PostMapping("/output") |
| | | public ResponseValue output(Long id) { |
| | | // 出库前 设置出库仓库 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = baseWarehouseService.getByAgencyId(Long.valueOf(agencyId), (short) 1, (short) 1); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getByAgencyId(Long.valueOf(agencyId), (short)1, (short)1); |
| | | if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | return ResponseValue.error("机构无默认仓库!"); |
| | | } |
| | |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "调拨单导出", notes = "调拨单导出") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "type", value = "导出类型 1 入库 2 出库", required = true, dataType = "Integer"), |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "调拨单id", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "type", value = "导出类型 1 入库 2 出库", required = true, dataType = "Integer"),}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, Integer type, HttpServletResponse response) throws Exception { |
| | | |
| | |
| | | params.setHeadingStartRow(2); |
| | | List<TransferExcelTemplate> export = this.lWhFormTransferService.export(id, type); |
| | | |
| | | int countNum = export.stream().filter(item -> item.getNum() != null).mapToInt(TransferExcelTemplate::getNum).sum(); |
| | | double totalAmount = export.stream().filter(item -> item.getTotalAmount() != null).mapToDouble(TransferExcelTemplate::getAmount).sum(); |
| | | int countNum = |
| | | export.stream().filter(item -> item.getNum() != null).mapToInt(TransferExcelTemplate::getNum).sum(); |
| | | double totalAmount = export.stream().filter(item -> item.getTotalAmount() != null) |
| | | .mapToDouble(TransferExcelTemplate::getAmount).sum(); |
| | | Optional<TransferExcelTemplate> first = export.stream().findFirst(); |
| | | TransferExcelTemplate entity = first.get(); |
| | | String businessFormCode = entity.getBusinessFormCode(); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 部门物品分发列表明细 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "部门物品分发列表明细", notes = "部门物品分发列表明细") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "transferQryDto", value = "调拨单查询条件", required = true) |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "transferQryDto", value = "调拨单查询条件", required = true)}) |
| | | @GetMapping("/department/list") |
| | | public ResponseValue departmentTransferList() { |
| | | TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); |
| | |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | GenericPager<Map<String, Object>> transferInfoDetailsVoGenericPager = this.lWhFormTransferService.queryTransferInfo(param); |
| | | GenericPager<Map<String, Object>> transferInfoDetailsVoGenericPager = |
| | | this.lWhFormTransferService.queryTransferInfo(param); |
| | | return ResponseValue.success(transferInfoDetailsVoGenericPager); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "使用人修改", notes = "使用人修改") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "procureModelInfoDto", value = "使用信息", required = true) |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "procureModelInfoDto", value = "使用信息", required = true)}) |
| | | @PostMapping("/useInfo/update") |
| | | public ResponseValue infoUpdate() { |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "部门物品使用人记录", notes = "部门物品使用人记录") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "transferOrderId", value = "调拨单id", required = true) |
| | | }) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "transferOrderId", value = "调拨单id", required = true)}) |
| | | @GetMapping("/use/record") |
| | | public ResponseValue useRecord(Long transferOrderId) { |
| | | |
| | |
| | | return ResponseValue.error("未查询到使用记录"); |
| | | } |
| | | List<GoodsUseRecordVO> goodsUseRecordList = Lists.newArrayList(); |
| | | //分组 |
| | | Map<Long, Map<Long, List<UseRecordDTO>>> collect = useRecordDTOList.stream() |
| | | .collect(Collectors.groupingBy(UseRecordDTO::getId, Collectors.groupingBy(UseRecordDTO::getBaseGoodsModelsId))); |
| | | //开始循环collect |
| | | // 分组 |
| | | Map<Long, Map<Long, List<UseRecordDTO>>> collect = useRecordDTOList.stream().collect( |
| | | Collectors.groupingBy(UseRecordDTO::getId, Collectors.groupingBy(UseRecordDTO::getBaseGoodsModelsId))); |
| | | // 开始循环collect |
| | | for (Map.Entry<Long, Map<Long, List<UseRecordDTO>>> entry : collect.entrySet()) { |
| | | Long id = entry.getKey(); |
| | | Map<Long, List<UseRecordDTO>> value = entry.getValue(); |
| | | //开始循环value |
| | | // 开始循环value |
| | | List<UseRecordSkuVO> useRecordSkuList = Lists.newArrayList(); |
| | | for (Map.Entry<Long, List<UseRecordDTO>> item : value.entrySet()) { |
| | | List<UseRecordDTO> list = item.getValue(); |
| | |
| | | } |
| | | } |
| | | } |
| | | //分组之后重新排序 |
| | | List<GoodsUseRecordVO> result = goodsUseRecordList.stream() |
| | | .sorted(Comparator.comparing(GoodsUseRecordVO::getUpdateTime |
| | | , Comparator.nullsFirst(Long::compareTo)).reversed()) |
| | | // 分组之后重新排序 |
| | | List<GoodsUseRecordVO> result = goodsUseRecordList |
| | | .stream().sorted(Comparator |
| | | .comparing(GoodsUseRecordVO::getUpdateTime, Comparator.nullsFirst(Long::compareTo)).reversed()) |
| | | .collect(Collectors.toList()); |
| | | return ResponseValue.success(result); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "查询部门下的分发单", notes = "查询部门下的分发单") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | @ApiImplicitParam(name = "agencyId", value = "机构id", required = true, dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/query/transfList") |
| | | public ResponseValue queryDepartmentTransferOrderList() { |
| | | |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/pc/warehouse/procureModel") |
| | |
| | | package com.consum.base.core; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.utils.SqlParameter; |
| | | import com.consum.model.po.BaseCodeIndexing; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 编码统一生成服务 |
| | |
| | | @Transactional(propagation = Propagation.NOT_SUPPORTED) |
| | | public class CodeGeneratorService extends BaseServiceImpl { |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String prefix = "RK"; |
| | | int[] days = DateUtils.getCurrentYearMonthDay(); |
| | | prefix += StringUtils.removeStart(Integer.valueOf(days[0]).toString(),"20"); |
| | | prefix += days[1] < 9 ? "0" + Integer.valueOf(days[1]).toString() : days[1]; |
| | | prefix += days[2] < 9 ? "0" + Integer.valueOf(days[2]).toString() : days[2]; |
| | | System.out.println(prefix); |
| | | } |
| | | |
| | | private String createCodeByPrefix(String prefix,int length){ |
| | | private String createCodeByPrefix(String prefix, int length) { |
| | | String CODE_PREFIX = prefix; |
| | | String sql = "SELECT * from BASE_CODE_INDEXING where CODE_PREFIX=:CODE_PREFIX"; |
| | | |
| | | BaseCodeIndexing codeIndexing = get(sql,new SqlParameter().put("CODE_PREFIX",CODE_PREFIX),new BaseCodeIndexing()); |
| | | if (codeIndexing == null){ |
| | | BaseCodeIndexing codeIndexing = |
| | | get(sql, new SqlParameter().put("CODE_PREFIX", CODE_PREFIX), new BaseCodeIndexing()); |
| | | if (codeIndexing == null) { |
| | | codeIndexing = new BaseCodeIndexing(); |
| | | codeIndexing.setId(NumberGenerator.getLongSequenceNumber()); |
| | | codeIndexing.setCodePrefix(CODE_PREFIX); |
| | | codeIndexing.setCodeIndex(1); |
| | | insert(codeIndexing); |
| | | } else { |
| | | codeIndexing.setCodeIndex(codeIndexing.getCodeIndex()+1); |
| | | codeIndexing.setCodeIndex(codeIndexing.getCodeIndex() + 1); |
| | | update(codeIndexing); |
| | | } |
| | | |
| | | String index = codeIndexing.getCodeIndex().toString(); |
| | | String intPrefix = "0"; |
| | | for (int i=1;i<(length-index.length());i++){ |
| | | for (int i = 1; i < (length - index.length()); i++) { |
| | | intPrefix += "0"; |
| | | } |
| | | return CODE_PREFIX+intPrefix+index; |
| | | return CODE_PREFIX + intPrefix + index; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 仓库编码规则为:WH+四位数字连号(0001) |
| | | */ |
| | | public synchronized String createWarehouseCode() { |
| | | /* |
| | | /* |
| | | 1.SELECT CODE_INDEX from BASE_CODE_INDEXING where CODE_PREFIX=:CODE_PREFIX |
| | | CODE_PREFIX是"WH" |
| | | 如果获取不到,就从1开始,但需要补全前面的"0"返回 "0001";同时需要插入数据库 |
| | |
| | | 2.如果能够获取到,则将CODE_INDEX=CODE_INDEX+1后更新到数据库,补全前面的"0"返回 "0001" |
| | | */ |
| | | String CODE_PREFIX = CodeGeneratorEnum.Warehouse.getValue(); |
| | | return createCodeByPrefix(CODE_PREFIX,4); |
| | | return createCodeByPrefix(CODE_PREFIX, 4); |
| | | } |
| | | |
| | | /** |
| | |
| | | 2.如果能够获取到,则将CODE_INDEX=CODE_INDEX+1后更新到数据库,补全前面的"0"返回 "000001" |
| | | */ |
| | | String prefix = classify; |
| | | return createCodeByPrefix(prefix,6); |
| | | return createCodeByPrefix(prefix, 6); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | String prefix = codeGeneratorEnum.getValue(); |
| | | int[] days = DateUtils.getCurrentYearMonthDay(); |
| | | prefix += StringUtils.removeStart(Integer.valueOf(days[0]).toString(),"20"); |
| | | prefix += StringUtils.removeStart(Integer.valueOf(days[0]).toString(), "20"); |
| | | prefix += days[1] < 9 ? "0" + Integer.valueOf(days[1]).toString() : days[1]; |
| | | prefix += days[2] < 9 ? "0" + Integer.valueOf(days[2]).toString() : days[2]; |
| | | return createCodeByPrefix(prefix,4); |
| | | return createCodeByPrefix(prefix, 4); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.consum.base.core; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.*; |
| | | import com.consum.base.service.GoodsBaseServiceImpl; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhGoodsRecordDetailsService; |
| | | import com.consum.base.service.LWhGoodsRecordService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.model.po.DepFormScrapped; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName DepFormScrappedCoreServiceImpl |
| | |
| | | @Resource |
| | | private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; |
| | | @Resource |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | @Resource |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | |
| | |
| | | return null; |
| | | } |
| | | // 批量插入 各规格物品的进出库【L_WH_GOODS_RECORD】 |
| | | lWhGoodsRecordService.insertBatch(lWhGoodsRecordList); |
| | | lWhGoodsRecordServiceImpl.insertBatch(lWhGoodsRecordList); |
| | | |
| | | // 更新报废单 |
| | | depFormScrapped = new DepFormScrapped(lWhFormScrappedId); |
| | |
| | | package com.consum.base.core; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.base.service.GoodsBaseServiceImpl; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhGoodsRecordDetailsService; |
| | | import com.consum.base.service.LWhGoodsRecordService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.UsingFormBack; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName DepFormScrappedCoreServiceImpl |
| | |
| | | @Resource |
| | | private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; |
| | | @Resource |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | @Resource |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | @Resource |
| | |
| | | return null; |
| | | } |
| | | // 批量插入 各规格物品的进出库【L_WH_GOODS_RECORD】 |
| | | lWhGoodsRecordService.insertBatch(lWhGoodsRecordList); |
| | | lWhGoodsRecordServiceImpl.insertBatch(lWhGoodsRecordList); |
| | | |
| | | // 更新报废单 |
| | | depFormScrapped = new UsingFormBack(lWhFormBackId); |
| | |
| | | return null; |
| | | } |
| | | // 批量插入 各规格物品的进出库【L_WH_GOODS_RECORD】 |
| | | lWhGoodsRecordService.insertBatch(flowRecordArrayList); |
| | | lWhGoodsRecordServiceImpl.insertBatch(flowRecordArrayList); |
| | | |
| | | return null; |
| | | } |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 物品信息 |
| | | * @date 2023/12/1 17:16 |
| | | */ |
| | | @Data |
| | | |
| | | public class BaseGoodsTemplateInfo { |
| | | |
| | | private String baseGoodsTemplateName; |
| | |
| | | private String agencyName; |
| | | |
| | | |
| | | private List<FormOutputTemplateInfoVO> formOutputTemplateInfoList; |
| | | private List<GoodsTemplateCountVO> formOutputTemplateInfoList; |
| | | |
| | | |
| | | } |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import java.util.List; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | // 主键 |
| | | private Long id; |
| | | |
| | | |
| | | // 属性列表 |
| | | private String businessFormCode; |
| | | |
| | | |
| | | private Long warehouseId; |
| | | |
| | | |
| | | private String warehouseName; |
| | | |
| | | |
| | | private Long buyerId; |
| | | |
| | | |
| | | private String buyerName; |
| | | |
| | | |
| | | private Long procureTime; |
| | | |
| | | |
| | | private String procureDoc; |
| | | |
| | | |
| | | private Integer buyType; |
| | | |
| | | |
| | | private Integer states; |
| | | |
| | | |
| | | private Long agencyId; |
| | | |
| | | |
| | | private String agencyName; |
| | | |
| | | |
| | | private Long incomeId; |
| | | |
| | | |
| | | private String incomeName; |
| | | |
| | | |
| | | private Long incomeTime; |
| | | |
| | | |
| | | private String beiz; |
| | | |
| | | |
| | | private Long lWarehouseFlowId; |
| | | |
| | | private List<FromProcureTemplateInfoVO> fromProcureTemplateInfoList; |
| | | |
| | | private List<GoodsTemplateCountVO> fromProcureTemplateInfoList; |
| | | |
| | | } |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import io.swagger.annotations.ApiModel; |
| | | import java.util.List; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "调拨单列表信息") |
| | | public class FormTransferVO extends LWhFormTransfer { |
| | | public class FormTransferVO { |
| | | |
| | | // 主键 |
| | | private Long id; |
| | | |
| | | // 属性列表 |
| | | private Long inWarehouseFormId; |
| | | |
| | | private Long inWarehouseFlowId; |
| | | |
| | | private Long outWarehouseFlowId; |
| | | |
| | | private Long outWarehouseFormId; |
| | | |
| | | private Integer businessType; |
| | | |
| | | private String businessFormCode; |
| | | |
| | | private Integer inWarehouseType; |
| | | |
| | | private Long inWarehouseId; |
| | | |
| | | private String inWarehouseName; |
| | | |
| | | private Integer outWarehouseType; |
| | | |
| | | private Long outWarehouseId; |
| | | |
| | | private String outWarehouseName; |
| | | |
| | | private Long inAgencyId; |
| | | |
| | | private String inAgencyName; |
| | | |
| | | private Long outAgencyId; |
| | | |
| | | private String outAgencyName; |
| | | |
| | | private Long operatorId; |
| | | |
| | | private String operatorName; |
| | | |
| | | private Long createTime; |
| | | |
| | | private Integer states; |
| | | |
| | | private Long inOperatorId; |
| | | |
| | | private String inOperatorName; |
| | | |
| | | private Long inTime; |
| | | |
| | | private Long outOperatorId; |
| | | |
| | | private String outOperatorName; |
| | | |
| | | private Long outputTime; |
| | | |
| | | private String procureDoc; |
| | | |
| | | private Long tel; |
| | | |
| | | /** |
| | | * 规格型号 |
| | | */ |
| | | private List<FromTransferTemplateInfoVO> fromTransferTemplateInfoList; |
| | | List<GoodsTemplateCountVO> fromTransferTemplateInfoList; |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 物品统计信息 |
| | | * @date 2023/11/10 11:37 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class GoodsTemplateCountVO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | @ApiModelProperty(value = "物品模板名称") |
| | | private String goodsName; |
| | | @ApiModelProperty(value = "物品模板名称") |
| | | private String goodsTemplateName; |
| | | @ApiModelProperty(value = "物品模板名称") |
| | | private String baseGoodsTemplateName; |
| | | @ApiModelProperty(value = "商品模板id") |
| | | private Long baseGoodsTemplateId; |
| | | @ApiModelProperty(value = "物品内全部型号统计数量") |
| | | private Integer count; |
| | | @ApiModelProperty(value = "单位") |
| | | private String unit; |
| | | |
| | | } |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import java.util.List; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | |
| | | private Long dealTime; |
| | | |
| | | |
| | | private Integer states; |
| | | |
| | | |
| | | /** |
| | | * 规格型号 |
| | | */ |
| | | private List<FromTransferTemplateInfoVO> goodTemplateInfo; |
| | | private List<GoodsTemplateCountVO> goodTemplateInfo; |
| | | } |
| | |
| | | private String businessFormCode; |
| | | private String operatorName; |
| | | |
| | | private List<BaseGoodsTemplateInfo> goodsTemplateInfoList; |
| | | private List<GoodsTemplateCountVO> goodsTemplateInfoList; |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName LWarehouseFlowService |
| | |
| | | private SimpleJdbcCall simpleJdbcCall; |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | private LWhGoodsService lWhGoodsService; |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | private BaseGoodsTemplateService baseGoodsTemplateService; |
| | | |
| | | @Value("${spring.datasource.dataBaseName}") |
| | |
| | | |
| | | @Autowired |
| | | public LWarehouseFlowCoreService(JdbcTemplate jdbcTemplate, LWarehouseFlowService lWarehouseFlowService, LWhGoodsService lWhGoodsService, |
| | | BaseGoodsTemplateService baseGoodsTemplateService, LWhGoodsRecordService lWhGoodsRecordService) { |
| | | BaseGoodsTemplateService baseGoodsTemplateService, LWhGoodsRecordService lWhGoodsRecordServiceImpl) { |
| | | this.jdbcTemplate = jdbcTemplate; |
| | | this.lWarehouseFlowService = lWarehouseFlowService; |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.lWhGoodsRecordService = lWhGoodsRecordService; |
| | | this.lWhGoodsRecordServiceImpl = lWhGoodsRecordServiceImpl; |
| | | } |
| | | |
| | | /** |
| | |
| | | ; |
| | | whGoodsRecord.setTotalPrice(totalPrice); |
| | | } |
| | | lWhGoodsRecordService.insert(whGoodsRecord); |
| | | lWhGoodsRecordServiceImpl.insert(whGoodsRecord); |
| | | }); |
| | | |
| | | return 1; |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @ClassName LWhFormInventoryCoreService |
| | |
| | | private LWhFormInventoryGoodsServiceImpl lWhFormInventoryGoods; |
| | | private LWhFormOutputCoreService lWhFormOutputCoreService; |
| | | private CodeGeneratorService codeGeneratorService; |
| | | private LWhFormProcureService lWhFormProcureService; |
| | | private LWhFormProcureService lWhFormProcureServiceImpl; |
| | | private BaseWarehouseService baseWarehouseService; |
| | | private LWhFormProcureGoodsService lWhFormProcureGoodsService; |
| | | private LWhFormProcureGoodsService lWhFormProcureGoodsServiceImpl; |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | private BaseGoodsTemplateService baseGoodsTemplateService; |
| | | private LWhGoodsService lWhGoodsService; |
| | |
| | | public LWhFormInventoryCoreService(LWhFormInventoryGoodsServiceImpl lWhFormInventoryGoods, |
| | | LWhFormOutputCoreService lWhFormOutputCoreService, |
| | | CodeGeneratorService codeGeneratorService, |
| | | LWhFormProcureService lWhFormProcureService, |
| | | LWhFormProcureService lWhFormProcureServiceImpl, |
| | | BaseWarehouseService baseWarehouseService, |
| | | LWhFormProcureGoodsService lWhFormProcureGoodsService, |
| | | LWhFormProcureGoodsService lWhFormProcureGoodsServiceImpl, |
| | | LWhProcureModelService lWhProcureModelService, |
| | | BaseGoodsTemplateService baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | |
| | | this.lWhFormInventoryGoods = lWhFormInventoryGoods; |
| | | this.lWhFormOutputCoreService = lWhFormOutputCoreService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | | this.lWhFormProcureService = lWhFormProcureService; |
| | | this.lWhFormProcureServiceImpl = lWhFormProcureServiceImpl; |
| | | this.baseWarehouseService = baseWarehouseService; |
| | | this.lWhFormProcureGoodsService = lWhFormProcureGoodsService; |
| | | this.lWhFormProcureGoodsServiceImpl = lWhFormProcureGoodsServiceImpl; |
| | | this.lWhProcureModelService = lWhProcureModelService; |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | |
| | | lWhFormProcure.setStates(1); |
| | | lWhFormProcure.setAgencyId(baseWarehouse.getAgencyId()); |
| | | lWhFormProcure.setAgencyName(baseWarehouse.getAgencyName()); |
| | | int result = lWhFormProcureService.insert(lWhFormProcure); |
| | | int result = lWhFormProcureServiceImpl.insert(lWhFormProcure); |
| | | if (result == 0) { |
| | | return null; |
| | | } |
| | |
| | | whProcureModeLlist.add(model); |
| | | procureGoodList.add(procureGood); |
| | | } |
| | | lWhFormProcureGoodsService.insertBatch(procureGoodList); |
| | | lWhFormProcureGoodsServiceImpl.insertBatch(procureGoodList); |
| | | lWhProcureModelService.insertBatch(whProcureModeLlist); |
| | | |
| | | HashMap<String, Object> rtnMap = new HashMap<>(); |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | /** |
| | | * @ClassName WhFormOutputCoreService |
| | |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | |
| | | @Autowired |
| | | public LWhFormOutputCoreService(BaseGoodsTemplateService baseGoodsTemplateService, |
| | |
| | | LWhFormOutputService lWhFormOutputService, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService, |
| | | LWhGoodsRecordService lWhGoodsRecordServiceImpl, |
| | | LWhWarningCoreServiceImpl lWhWarningCoreService) { |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | |
| | | this.lWhFormOutputService = lWhFormOutputService; |
| | | this.lWarehouseFlowService = lWarehouseFlowService; |
| | | this.lWhGoodsRecordDetailsService = lWhGoodsRecordDetailsService; |
| | | this.lWhGoodsRecordService = lWhGoodsRecordService; |
| | | this.lWhGoodsRecordServiceImpl = lWhGoodsRecordServiceImpl; |
| | | this.lWhWarningCoreService = lWhWarningCoreService; |
| | | } |
| | | |
| | |
| | | long totalAmount = lWhGoodsService.queryGoodsPriceById(outGoodsId); |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(itemModelInfo.getId()); |
| | | whGoodsRecord.setTotalPrice(totalAmount); |
| | | lWhGoodsRecordService.insert(whGoodsRecord); |
| | | lWhGoodsRecordServiceImpl.insert(whGoodsRecord); |
| | | lWhProcureModel.setTotalAmount(totalAmount); |
| | | lWhProcureModelService.update(lWhProcureModel); |
| | | }); |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | /** |
| | | * @Description 出库单 |
| | |
| | | |
| | | private static String QUERY_FORM_OUTPUT_LIST = "SELECT * FROM l_wh_form_output WHERE 1 = 1"; |
| | | |
| | | |
| | | /** |
| | | * @Description 新增出库单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/27 |
| | | */ |
| | | public int add(LWhFormOutputParam param, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | //1.新增出库单记录 |
| | | // 1.新增出库单记录 |
| | | LWhFormOutput lWhFormOutput = new LWhFormOutput(); |
| | | //出入库id |
| | | // 出入库id |
| | | long lWhFormOutputId = IdUtil.generateId(); |
| | | lWhFormOutput.setId(lWhFormOutputId); |
| | | lWhFormOutput.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.OutPut_Warehouse)); |
| | | lWhFormOutput |
| | | .setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.OutPut_Warehouse)); |
| | | Long warehouseId = param.getWarehouseId(); |
| | | lWhFormOutput.setWarehouseId(warehouseId); |
| | | //根据仓库id查询仓库 |
| | | // 根据仓库id查询仓库 |
| | | BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId); |
| | | if (warehouse == null) { |
| | | log.error("仓库id不存在"); |
| | |
| | | log.error("新增出库单记录"); |
| | | return 0; |
| | | } |
| | | //2.新增物品型号记录 |
| | | // 2.新增物品型号记录 |
| | | List<LWFormsOutputGoodsInfoParam> goodsList = param.getGoods(); |
| | | List<LWhProcureModel> modelList = new ArrayList<>(); |
| | | for (LWFormsOutputGoodsInfoParam goods : goodsList) { |
| | |
| | | lWhProcureModel.setBusinessType(3); |
| | | lWhProcureModel.setBusinessId(lWhFormOutputId); |
| | | lWhProcureModel.setBaseGoodsModelsId(model.getBaseGoodsModelsId()); |
| | | //根据型号id查询型号 |
| | | BaseGoodsModels baseGoodsModels = this.baseGoodsModelsService.get(new BaseGoodsModels(model.getBaseGoodsModelsId())); |
| | | // 根据型号id查询型号 |
| | | BaseGoodsModels baseGoodsModels = |
| | | this.baseGoodsModelsService.get(new BaseGoodsModels(model.getBaseGoodsModelsId())); |
| | | if (baseGoodsModels != null) { |
| | | lWhProcureModel.setBaseGoodsModelsName(baseGoodsModels.getModelName()); |
| | | } |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, model.getBaseGoodsModelsId(), 1, null); |
| | | // 根据物品型号查询物品库存 |
| | | int goodsNum = |
| | | this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, model.getBaseGoodsModelsId(), 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | modelList.add(lWhProcureModel); |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | //3.根据出库单出库 |
| | | Long lWarehouseFlowId = this.lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.CHUKU, currentUser, param.getDealTime(), null); |
| | | // 3.根据出库单出库 |
| | | Long lWarehouseFlowId = this.lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.CHUKU, |
| | | currentUser, param.getDealTime(), null); |
| | | if (lWarehouseFlowId == null) { |
| | | log.error("根据出库单出库失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | public GenericPager queryFormOutputList(LWhFormOutputQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_FORM_OUTPUT_LIST); |
| | | //出库单号 |
| | | // 出库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsName())) { |
| | | sql.append( |
| | | " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=3 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //机构 |
| | | // 机构 |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append(" and operator_name =:operator_name "); |
| | | paramts.put("operator_name", param.getCreateName()); |
| | | } |
| | | //状态 |
| | | // 状态 |
| | | if (param.getStates() != null) { |
| | | sql.append(" and states =:states "); |
| | | paramts.put("states", param.getStates()); |
| | | } |
| | | //出库时间 |
| | | // 出库时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and DEAL_TIME >=:outputTimeStart "); |
| | | paramts.put("outputTimeStart", param.getStartTime() * 1000000); |
| | |
| | | |
| | | public GenericPager<Map<String, Object>> queryFormOutputDetailList(LWhFormOutputQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder("SELECT pm.id,fp.BUSINESS_FORM_CODE,fpg.GOODS_TEMPLATE_NAME,pm.PRICE,pm.COUNTS, " |
| | | + "( pm.PRICE * pm.COUNTS ) amount,fp.AGENCY_NAME,fp.BUYER_NAME,fp.PROCURE_TIME,pm.BUSINESS_ID,pm.BASE_GOODS_MODELS_NAME FROM l_wh_procure_model pm " |
| | | + "LEFT JOIN l_wh_form_procure fp ON pm.BUSINESS_ID = fp.id " |
| | | + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID WHERE pm.BUSINESS_TYPE = 1 "); |
| | | //入库单号 |
| | | StringBuilder sql = |
| | | new StringBuilder("SELECT pm.id,fp.BUSINESS_FORM_CODE,fpg.GOODS_TEMPLATE_NAME,pm.PRICE,pm.COUNTS, " |
| | | + "( pm.PRICE * pm.COUNTS ) amount,fp.AGENCY_NAME,fp.BUYER_NAME,fp.PROCURE_TIME,pm.BUSINESS_ID,pm.BASE_GOODS_MODELS_NAME FROM l_wh_procure_model pm " |
| | | + "LEFT JOIN l_wh_form_procure fp ON pm.BUSINESS_ID = fp.id " |
| | | + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID WHERE pm.BUSINESS_TYPE = 1 "); |
| | | // 入库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append("and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsName())) { |
| | | sql.append("and fpg.GOODS_TEMPLATE_NAME like :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append("and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append("and buyer_Name =:buyerName "); |
| | | paramts.put("buyerName", param.getCreateName()); |
| | | } |
| | | //入库开始时间 |
| | | // 入库开始时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and INCOME_TIME >=:incomeTimeStart "); |
| | | paramts.put("incomeTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | //入库结束时间 |
| | | // 入库结束时间 |
| | | if (param.getEndTime() != null) { |
| | | sql.append("and INCOME_TIME <:incomeTimeEnd "); |
| | | paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | //规格型号 |
| | | // 规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and pm.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | |
| | | sql.append("ORDER BY PROCURE_TIME DESC"); |
| | | GenericPager genericPager = selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | GenericPager genericPager = |
| | | selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | return genericPager; |
| | | |
| | | } |
| | | |
| | | public List<OutputExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" |
| | | + "\tfo.BUSINESS_FORM_CODE,\n" |
| | | + "\tfo.AGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tfo.DEAL_TIME createTime,\n" |
| | | + "\tfo.OPERATOR_NAME,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | String sql = "SELECT\n" + "\tfo.BUSINESS_FORM_CODE,\n" + "\tfo.AGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_NAME templateName,\n" + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" + "\tfo.DEAL_TIME createTime,\n" + "\tfo.OPERATOR_NAME,\n" |
| | | + "\tBEIZ remark\n" + "FROM\n" + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_output fo ON fo.ID = pm.BUSINESS_ID\n" |
| | | + "WHERE\n" |
| | | + "\tpm.BUSINESS_ID = :id"; |
| | | + "\tLEFT JOIN l_wh_form_output fo ON fo.ID = pm.BUSINESS_ID\n" + "WHERE\n" + "\tpm.BUSINESS_ID = :id"; |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureCoreService |
| | |
| | | **/ |
| | | @Service |
| | | @Slf4j |
| | | @Transactional(propagation= Propagation.REQUIRED) |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public class LWhFormProcureCoreService { |
| | | @Resource |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | |
| | | @Resource |
| | | private LWhFormProcureService lWhFormProcureService; |
| | | private LWhFormProcureService lWhFormProcureServiceImpl; |
| | | |
| | | @Resource |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | |
| | | private LWarehouseFlowCoreService lWarehouseFlowService; |
| | | |
| | | /** |
| | | * 执行采购入库 |
| | | * 第一步:通过采购单ID查询采购单型号【L_WH_PROCURE_MODEL】得到商品型号以及数量 |
| | | * 第二步:记录进出库流水:L_WAREHOUSE_FLOW |
| | | * 执行采购入库 第一步:通过采购单ID查询采购单型号【L_WH_PROCURE_MODEL】得到商品型号以及数量 第二步:记录进出库流水:L_WAREHOUSE_FLOW |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String doProcure(Long whFormProcureId, S_user_core currentUser) { |
| | | if (whFormProcureId == null) { |
| | | return "采购单id为空"; |
| | | } |
| | | //采购单信息 |
| | | // 采购单信息 |
| | | LWhFormProcure whFormProcure = new LWhFormProcure(whFormProcureId); |
| | | LWhFormProcure lWhFormProcure = lWhFormProcureService.get(whFormProcure); |
| | | LWhFormProcure lWhFormProcure = lWhFormProcureServiceImpl.get(whFormProcure); |
| | | if (lWhFormProcure == null || lWhFormProcure.getStates() != 1) { |
| | | log.error("入库失败!请检查入库单状态"); |
| | | return "入库失败!请检查入库单状态"; |
| | |
| | | String nickName = currentUser.getNick_name(); |
| | | long dealTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | |
| | | List<LWhProcureModel> goodsModelNum = lWhProcureModelService.getModelByForm(WhBusinessEnum.CAIGOU, whFormProcureId); |
| | | List<LWhProcureModel> goodsModelNum = |
| | | lWhProcureModelService.getModelByForm(WhBusinessEnum.CAIGOU, whFormProcureId); |
| | | // 流水记录总表ID |
| | | Long warehouseId = lWhFormProcure.getWarehouseId(); |
| | | long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); |
| | |
| | | whFormProcure.setIncomeId(userId); |
| | | whFormProcure.setIncomeName(nickName); |
| | | whFormProcure.setIncomeTime(dealTime); |
| | | lWhFormProcureService.update(whFormProcure); |
| | | lWhFormProcureServiceImpl.update(whFormProcure); |
| | | } |
| | | |
| | | |
| | | // 提取baseGoodsModelsId并放入新的List中 |
| | | List<Long> allChangModelList = goodsModelNum.stream() |
| | | .map(LWhProcureModel::getBaseGoodsModelsId) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | //当库存变动时调用该方法 |
| | | lWhWarningCoreService.updateKuCun((short) 0, warehouseId, allChangModelList, null, dealTime); |
| | | List<Long> allChangModelList = |
| | | goodsModelNum.stream().map(LWhProcureModel::getBaseGoodsModelsId).distinct().collect(Collectors.toList()); |
| | | // 当库存变动时调用该方法 |
| | | lWhWarningCoreService.updateKuCun((short)0, warehouseId, allChangModelList, null, dealTime); |
| | | |
| | | log.info("入库单:{} 入库完成", whFormProcureId); |
| | | return null; |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureGoodsService |
| | | |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhFormProcureGoodsService extends BaseServiceImpl { |
| | | public interface LWhFormProcureGoodsService extends BaseService { |
| | | |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @ClassName lWhFormProcureService |
| | | * @Date 2023/10/24 |
| | | * @Description 采购单 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhFormProcureService extends BaseServiceImpl { |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | private static String QUERY_FORM_PROCURE_LIST = "SELECT * FROM L_WH_FORM_PROCURE WHERE 1 = 1"; |
| | | public interface LWhFormProcureService extends BaseService { |
| | | |
| | | public PageUtil<LWhFormProcure> queryFormProcureList(FormProcureQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_FORM_PROCURE_LIST); |
| | | //入库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and BUSINESS_FORM_CODE like :businessFormCode "); |
| | | paramts.put("businessFormCode", StringUtils.CHAR_PERCENT + param.getBusinessFormCode() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append(" and buyer_Name =:buyerName "); |
| | | paramts.put("buyerName", param.getCreateName()); |
| | | } |
| | | //状态 |
| | | if (param.getStates() != null) { |
| | | sql.append(" and states =:states "); |
| | | paramts.put("states", param.getStates()); |
| | | } |
| | | //入库时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and INCOME_TIME >=:incomeTimeStart "); |
| | | paramts.put("incomeTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | if (param.getEndTime() != null) { |
| | | sql.append(" and INCOME_TIME <:incomeTimeEnd "); |
| | | paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | //物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append( |
| | | " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | sql.append(" ORDER BY PROCURE_TIME DESC"); |
| | | GenericPager genericPager = selectSplit(sql.toString(), paramts, new LWhFormProcure()); |
| | | PageUtil pageUtil = new PageUtil(genericPager); |
| | | return pageUtil; |
| | | PageUtil<LWhFormProcure> queryFormProcureList(FormProcureQry param); |
| | | |
| | | } |
| | | /** |
| | | * 采购单明细查询 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | GenericPager<Map<String, Object>> queryFormProcureDetailList(FormProcureQry param); |
| | | |
| | | public GenericPager<Map<String, Object>> queryFormProcureDetailList(FormProcureQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder("SELECT pm.id,fp.BUSINESS_FORM_CODE,fpg.GOODS_TEMPLATE_NAME,pm.PRICE,pm.COUNTS, " |
| | | + "( pm.PRICE * pm.COUNTS ) amount,fp.AGENCY_NAME,fp.BUYER_NAME,fp.PROCURE_TIME,pm.BUSINESS_ID,pm.BASE_GOODS_MODELS_NAME FROM l_wh_procure_model pm " |
| | | + "LEFT JOIN l_wh_form_procure fp ON pm.BUSINESS_ID = fp.id " |
| | | + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID WHERE pm.BUSINESS_TYPE = 1 "); |
| | | //入库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append("and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append("and fpg.GOODS_TEMPLATE_NAME like :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append("and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append("and buyer_Name =:buyerName "); |
| | | paramts.put("buyerName", param.getCreateName()); |
| | | } |
| | | //入库开始时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and INCOME_TIME >=:incomeTimeStart "); |
| | | paramts.put("incomeTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | //入库结束时间 |
| | | if (param.getEndTime() != null) { |
| | | sql.append("and INCOME_TIME <:incomeTimeEnd "); |
| | | paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | //规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and pm.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | /** |
| | | * 导出 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<ProcureExcelTemplate> getExportList(Long id); |
| | | |
| | | sql.append("ORDER BY PROCURE_TIME DESC"); |
| | | GenericPager genericPager = selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | return genericPager; |
| | | |
| | | } |
| | | |
| | | public List<ProcureExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" |
| | | + "\tfp.BUSINESS_FORM_CODE,\n" |
| | | + "\tfp.AGENCY_NAME tenantName,\n" |
| | | + "\tfp.INCOME_TIME createTime,\n" |
| | | + "\tfp.INCOME_NAME operatorName,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\tprice,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tWAREHOUSE_NAME,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_procure fp ON fp.ID = pm.BUSINESS_ID\n" |
| | | + "WHERE\n" |
| | | + "\tpm.BUSINESS_ID = :id"; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | |
| | | List<ProcureExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | ProcureExcelTemplate templateExcelExport = MapUtils.convertMapToObj(item, ProcureExcelTemplate.class); |
| | | templateExcelExport.setAmount(CurrencyUtil.convertFenToYuan(templateExcelExport.getTotalAmount())); |
| | | templateExcelExport.setPrice(CurrencyUtil.convertFenToYuan(templateExcelExport.getPrice())); |
| | | list.add(templateExcelExport); |
| | | }); |
| | | return list; |
| | | |
| | | |
| | | } |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param param |
| | | * @param sysTenantUser |
| | | * @param currentUser |
| | | */ |
| | | void add(LWhFormProcureParam param, FinSysTenantUser sysTenantUser, S_user_core currentUser); |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | /** |
| | | * @ClassName LWhFormScrappedCoreService |
| | |
| | | private BaseGoodsTemplateService baseGoodsTemplateService; |
| | | private LWhGoodsService lWhGoodsService; |
| | | private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | private LWhWarningCoreServiceImpl lWhWarningCoreService; |
| | | |
| | |
| | | BaseGoodsTemplateService baseGoodsTemplateService, |
| | | LWhGoodsService lWhGoodsService, |
| | | LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, |
| | | LWhGoodsRecordService lWhGoodsRecordService, |
| | | LWhGoodsRecordService lWhGoodsRecordServiceImpl, |
| | | LWarehouseFlowService lWarehouseFlowService, |
| | | LWhWarningCoreServiceImpl lWhWarningCoreService) { |
| | | // this.lWhFormScrappedService = lWhFormScrappedService; |
| | |
| | | this.baseGoodsTemplateService = baseGoodsTemplateService; |
| | | this.lWhGoodsService = lWhGoodsService; |
| | | this.lWhGoodsRecordDetailsService = lWhGoodsRecordDetailsService; |
| | | this.lWhGoodsRecordService = lWhGoodsRecordService; |
| | | this.lWhGoodsRecordServiceImpl = lWhGoodsRecordServiceImpl; |
| | | this.lWarehouseFlowService = lWarehouseFlowService; |
| | | this.goodsBaseService = goodsBaseService; |
| | | this.lWhWarningCoreService = lWhWarningCoreService; |
| | |
| | | // 批量插入 进出库流水明细[L_WH_GOODS_RECORD_DETAILS] |
| | | lWhGoodsRecordDetailsService.sameGoodsInsertMore(srappedGoodsIds, whGoodsRecordId, (short) 2); |
| | | } |
| | | lWhGoodsRecordService.insert(whGoodsRecord); |
| | | lWhGoodsRecordServiceImpl.insert(whGoodsRecord); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormScrappedParam; |
| | | import com.consum.base.pojo.excel.ScrappedInfoExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormScrappedQry; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | public interface LWhFormScrappedService extends BaseService { |
| | | |
| | | int add(LWhFormScrappedParam param, S_user_core currentUser, FinSysTenantUser sysInfo); |
| | | |
| | | PageUtil queryList(LWhFormScrappedQry param, FinSysTenantUser sysInfo); |
| | | |
| | | LWhFormScrappedExtendVO getById(Long id); |
| | | |
| | | /** |
| | | * 报废单据明细查询 |
| | | * |
| | | * @param param |
| | | * @param sysInfo |
| | | * @return |
| | | */ |
| | | PageUtil queryDetailList(LWhFormScrappedQry param, FinSysTenantUser sysInfo); |
| | | |
| | | /** |
| | | * 导出报废单据查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<ScrappedInfoExcelTemplate> export(Long id); |
| | | |
| | | /** |
| | | * 统计报废单物品型号数量 |
| | | * |
| | | * @param businessId |
| | | * @return |
| | | */ |
| | | List<GoodsTemplateCountVO> getScrappedCountByBusinessId(Long businessId); |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.*; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.service.LWhWarningCoreServiceImpl; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.LockManage; |
| | | import com.consum.model.po.LGoodsUserRecord; |
| | | import com.consum.model.po.LWarehouseFlow; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhGoodsRecord; |
| | | import com.consum.model.po.LWhGoodsRecordDetails; |
| | | import com.consum.model.po.LWhProcureModelUser; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @ClassName LWhFormTransferCoreService |
| | |
| | | @Resource |
| | | private GoodsBaseServiceImpl goodsBaseService; |
| | | @Resource |
| | | private LWhGoodsRecordService lWhGoodsRecordService; |
| | | private LWhGoodsRecordService lWhGoodsRecordServiceImpl; |
| | | @Resource |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Resource |
| | |
| | | ArrayList<Long> allChangModelList = new ArrayList<>(); |
| | | LWhGoodsRecord lWhGoodsRecord = new LWhGoodsRecord(); |
| | | lWhGoodsRecord.setWarehouseFlowId(outWarehouseFlowId); |
| | | List<LWhGoodsRecord> whGoodsRecordList = lWhGoodsRecordService.select(lWhGoodsRecord); |
| | | List<LWhGoodsRecord> whGoodsRecordList = lWhGoodsRecordServiceImpl.select(lWhGoodsRecord); |
| | | for (LWhGoodsRecord whGoodsRecord : whGoodsRecordList) { |
| | | Long oldRecordId = whGoodsRecord.getId(); |
| | | Long baseGoodsModelsId = whGoodsRecord.getBaseGoodsModelsId(); |
| | |
| | | } |
| | | lWhGoodsRecordDetailsService.insertBatch(goodsRecordDetailsList); |
| | | } |
| | | lWhGoodsRecordService.insertBatch(whGoodsRecordList); |
| | | lWhGoodsRecordServiceImpl.insertBatch(whGoodsRecordList); |
| | | |
| | | // 更新调拨单 |
| | | lWhFormTransfer = new LWhFormTransfer(whFormTransferId); |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.consum.base.pojo.excel.TransferExcelTemplate; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | | import com.consum.base.pojo.request.LWhFormTransferParam; |
| | |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.jdbc.service.BaseService; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface LWhFormTransferService extends BaseService { |
| | | |
| | | long add(LWhFormTransferParam param, FinSysTenantUser sysInfo) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | GenericPager<LWhFormTransfer> queryFormTransferList(TransferQry param); |
| | | |
| | | /** |
| | | * @Description 根据id查询详情 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/30 |
| | | */ |
| | | LWHFromTransferExtendVO getById(Long id); |
| | | |
| | | |
| | | /** |
| | | * @Description 导出调拨出库单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | List<TransferExcelTemplate> export(Long id, Integer type); |
| | | |
| | | /** |
| | | * 撤销 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/31 |
| | | */ |
| | | int updateStatus(Long id); |
| | | |
| | | GenericPager<Map<String, Object>> queryTransferInfo(TransferQry transferQry); |
| | | |
| | | |
| | | GenericPager<Map<String, Object>> queryFormTransferDetailList(TransferQry param); |
| | | |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | /** |
| | | * @ClassName LWhGoodsRecordService |
| | | |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhGoodsRecordService extends BaseServiceImpl { |
| | | |
| | | public interface LWhGoodsRecordService extends BaseService { |
| | | |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName LWhProcureModelService |
| | | * @Date 2023/10/24 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhProcureModelService extends BaseServiceImpl { |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | private static String GET_MODEL_BY_FORM = "SELECT * FROM L_WH_PROCURE_MODEL WHERE 1=1 "; |
| | | public interface LWhProcureModelService extends BaseService { |
| | | |
| | | List<LWhProcureModel> getModelByForm(WhBusinessEnum businessType, Long businessId); |
| | | |
| | | List<Map<String, Object>> getFfOrderByGoodsIdAndDept(Long goodsTemplateId, Long departmentId); |
| | | |
| | | List<Map<String, Object>> getGoodsUseInfoByFfOrderAndGoodId(Long goodsTemplateId, Long transBusinessId); |
| | | |
| | | /** |
| | | * 通过单据类型 单据ID查询该订单关联的设备型号以及数量 |
| | | * |
| | | * 统计商品型号数量 |
| | | * |
| | | * @param businessId |
| | | * @return |
| | | */ |
| | | public List<LWhProcureModel> getModelByForm(WhBusinessEnum businessType, Long businessId) { |
| | | StringBuilder sql = new StringBuilder(GET_MODEL_BY_FORM); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | //项目阶段id |
| | | if (businessType != null) { |
| | | sql.append(" and BUSINESS_TYPE=:businessType "); |
| | | paramts.put("businessType", businessType.getValue()); |
| | | } |
| | | if (businessId != null) { |
| | | sql.append(" and BUSINESS_ID=:businessId "); |
| | | paramts.put("businessId", businessId); |
| | | } |
| | | return this.select(sql.toString(), paramts, new LWhProcureModel()); |
| | | } |
| | | List<GoodsTemplateCountVO> getGoodsTemplateCountByBusinessId(Long businessId); |
| | | |
| | | /** |
| | | * 根据部门、物品查询调拨单 |
| | | * |
| | | * @param goodsTemplateId 物品ID |
| | | * @param departmentId 部门ID |
| | | * 统计采购单物品型号数量 |
| | | * |
| | | * @param businessId |
| | | * @return |
| | | */ |
| | | private static String GET_FF_ORDER_BY_GOODS_ID_AND_DEPT = "SELECT trans.ID TRANS_BUSINESS_ID,trans.BUSINESS_FORM_CODE,baseTemp.ID BASE_GOODS_TEMPLATE_ID,baseTemp.GOODS_NAME BASE_GOODS_TEMPLATE_NAME,sum(proModel.COUNTS) total_count,sum(proModel.USE_COUNT) use_count,trans.IN_TIME FROM L_WH_FORM_TRANSFER trans LEFT JOIN L_WH_PROCURE_MODEL proModel ON proModel.BUSINESS_ID=trans.id LEFT JOIN BASE_GOODS_MODELS baseModel ON proModel.BASE_GOODS_MODELS_ID=baseModel.id LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseTemp.id=baseModel.GOODS_TEMPLATES_ID WHERE proModel.BUSINESS_TYPE=4 AND proModel.USE_COUNT> 0 "; |
| | | private static String GET_FF_ORDER_BY_GOODS_ID_AND_DEPT_END = " GROUP BY trans.ID,trans.BUSINESS_FORM_CODE,baseTemp.ID,baseTemp.GOODS_NAME,trans.IN_TIME order by trans.BUSINESS_FORM_CODE desc"; |
| | | |
| | | public List<Map<String, Object>> getFfOrderByGoodsIdAndDept(Long goodsTemplateId, Long departmentId) { |
| | | StringBuilder sql = new StringBuilder(GET_FF_ORDER_BY_GOODS_ID_AND_DEPT); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | //项目阶段id |
| | | if (goodsTemplateId != null) { |
| | | sql.append(" AND baseTemp.ID=:goodsTemplateId "); |
| | | paramts.put("goodsTemplateId", goodsTemplateId); |
| | | } |
| | | if (departmentId != null) { |
| | | sql.append(" AND trans.IN_WAREHOUSE_TYPE=1 and trans.IN_WAREHOUSE_ID=:departmentId "); |
| | | paramts.put("departmentId", departmentId); |
| | | } |
| | | return select(sql.append(GET_FF_ORDER_BY_GOODS_ID_AND_DEPT_END).toString(), paramts, new MapperUtil()); |
| | | } /** |
| | | * 根据部门、物品查询调拨单 |
| | | * |
| | | * @param goodsTemplateId 物品ID |
| | | * @param departmentId 分发单ID |
| | | * @return |
| | | */ |
| | | private static String GET_GOODS_USE_INFO_BY_FF_ORDER_AND_GOOD_ID = "SELECT baseModel.GOODS_TEMPLATES_ID,proModel.BASE_GOODS_MODELS_ID,baseModel.MODEL_NAME,baseModel.UNIT,CONCAT(baseCate.CLASSIFICATION,'类') CLASSIFICATION,modelUser.id MODEL_USER_id,modelUser.NOW_USER_PHONE,modelUser.NOW_USER_NAME,CASE WHEN modelUser.id IS NULL THEN proModel.USE_COUNT ELSE modelUser.USE_COUNT END AS user_Use_Count,CASE WHEN modelUser.id IS NULL THEN proModel.COUNTS ELSE modelUser.GOODS_NUM END AS GOODS_NUM FROM L_WH_PROCURE_MODEL proModel LEFT JOIN BASE_GOODS_MODELS baseModel ON proModel.BASE_GOODS_MODELS_ID=baseModel.id LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseTemp.id=baseModel.GOODS_TEMPLATES_ID LEFT JOIN BASE_CATEGORY baseCate ON baseCate.id=baseTemp.CATEGORY_ID LEFT JOIN L_WH_PROCURE_MODEL_USER modelUser ON modelUser.WH_PROCURE_MODEL_ID=proModel.id WHERE proModel.BUSINESS_TYPE=4 AND proModel.USE_COUNT> 0 "; |
| | | |
| | | public List<Map<String, Object>> getGoodsUseInfoByFfOrderAndGoodId(Long goodsTemplateId, Long transBusinessId) { |
| | | StringBuilder sql = new StringBuilder(GET_GOODS_USE_INFO_BY_FF_ORDER_AND_GOOD_ID); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | if (goodsTemplateId != null) { |
| | | sql.append(" AND baseModel.GOODS_TEMPLATES_ID=:goodsTemplateId "); |
| | | paramts.put("goodsTemplateId", goodsTemplateId); |
| | | } |
| | | if (transBusinessId != null) { |
| | | sql.append(" AND proModel.BUSINESS_ID=:transBusinessId "); |
| | | paramts.put("transBusinessId", transBusinessId); |
| | | } |
| | | return select(sql.toString(), paramts, new MapperUtil()); |
| | | } |
| | | List<GoodsTemplateCountVO> getProcureCountByBusinessId(Long businessId); |
| | | } |
New file |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | /** |
| | | * LWhProcureModelUserRecordService |
| | | * |
| | | * @author asus |
| | | * @version 2023/12/05 09:36 |
| | | **/ |
| | | public interface LWhProcureModelUserRecordService extends BaseService { |
| | | |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface UsingFormBackModelService extends BaseService { |
| | | |
| | | /** |
| | | * 统计回收单物品数量 |
| | | * |
| | | * @param businessId |
| | | * @return |
| | | */ |
| | | List<GoodsTemplateCountVO> getUsingCountByBusinessId(Long businessId); |
| | | } |
New file |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureGoodsService |
| | | * |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhFormProcureGoodsServiceImpl extends BaseServiceImpl implements LWhFormProcureGoodsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.LOrgSupplierServiceImpl; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LOrgSupplier; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @ClassName lWhFormProcureService |
| | | * @Date 2023/10/24 |
| | | * @Description 采购单 |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhFormProcureServiceImpl extends BaseServiceImpl implements LWhFormProcureService { |
| | | |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | @Resource |
| | | private LOrgSupplierServiceImpl lOrgSupplierService; |
| | | @Autowired |
| | | private BaseGoodsTemplateService baseGoodsTemplateService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |
| | | private LWhFormProcureGoodsService lWhFormProcureGoodsService; |
| | | @Autowired |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | |
| | | private static String QUERY_FORM_PROCURE_LIST = "SELECT * FROM L_WH_FORM_PROCURE WHERE 1 = 1"; |
| | | |
| | | @Override |
| | | public PageUtil<LWhFormProcure> queryFormProcureList(FormProcureQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_FORM_PROCURE_LIST); |
| | | // 入库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and BUSINESS_FORM_CODE like :businessFormCode "); |
| | | paramts.put("businessFormCode", |
| | | StringUtils.CHAR_PERCENT + param.getBusinessFormCode() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append(" and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append(" and buyer_Name =:buyerName "); |
| | | paramts.put("buyerName", param.getCreateName()); |
| | | } |
| | | // 状态 |
| | | if (param.getStates() != null) { |
| | | sql.append(" and states =:states "); |
| | | paramts.put("states", param.getStates()); |
| | | } |
| | | // 入库时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and INCOME_TIME >=:incomeTimeStart "); |
| | | paramts.put("incomeTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | if (param.getEndTime() != null) { |
| | | sql.append(" and INCOME_TIME <:incomeTimeEnd "); |
| | | paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append( |
| | | " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)"); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | sql.append(" ORDER BY PROCURE_TIME DESC"); |
| | | GenericPager genericPager = selectSplit(sql.toString(), paramts, new LWhFormProcure()); |
| | | PageUtil pageUtil = new PageUtil(genericPager); |
| | | return pageUtil; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public GenericPager<Map<String, Object>> queryFormProcureDetailList(FormProcureQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = |
| | | new StringBuilder("SELECT pm.id,fp.BUSINESS_FORM_CODE,fpg.GOODS_TEMPLATE_NAME,pm.PRICE,pm.COUNTS, " |
| | | + "( pm.PRICE * pm.COUNTS ) amount,fp.AGENCY_NAME,fp.BUYER_NAME,fp.PROCURE_TIME,pm.BUSINESS_ID,pm.BASE_GOODS_MODELS_NAME FROM l_wh_procure_model pm " |
| | | + "LEFT JOIN l_wh_form_procure fp ON pm.BUSINESS_ID = fp.id " |
| | | + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID WHERE pm.BUSINESS_TYPE = 1 "); |
| | | // 入库单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append("and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append("and fpg.GOODS_TEMPLATE_NAME like :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append("and AGENCY_ID like :agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getCreateName())) { |
| | | sql.append("and buyer_Name =:buyerName "); |
| | | paramts.put("buyerName", param.getCreateName()); |
| | | } |
| | | // 入库开始时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and INCOME_TIME >=:incomeTimeStart "); |
| | | paramts.put("incomeTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | // 入库结束时间 |
| | | if (param.getEndTime() != null) { |
| | | sql.append("and INCOME_TIME <:incomeTimeEnd "); |
| | | paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | // 规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and pm.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | |
| | | sql.append("ORDER BY PROCURE_TIME DESC"); |
| | | GenericPager genericPager = |
| | | selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | return genericPager; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcureExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" + "\tfp.BUSINESS_FORM_CODE,\n" + "\tfp.AGENCY_NAME tenantName,\n" |
| | | + "\tfp.INCOME_TIME createTime,\n" + "\tfp.INCOME_NAME operatorName,\n" + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" + "\tcounts num,\n" + "\tprice,\n" |
| | | + "\ttotal_amount totalAmount,\n" + "\tWAREHOUSE_NAME,\n" + "\tBEIZ remark\n" + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_procure fp ON fp.ID = pm.BUSINESS_ID\n" + "WHERE\n" + "\tpm.BUSINESS_ID = :id"; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | |
| | | List<ProcureExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | ProcureExcelTemplate templateExcelExport = MapUtils.convertMapToObj(item, ProcureExcelTemplate.class); |
| | | templateExcelExport.setAmount(CurrencyUtil.convertFenToYuan(templateExcelExport.getTotalAmount())); |
| | | templateExcelExport.setPrice(CurrencyUtil.convertFenToYuan(templateExcelExport.getPrice())); |
| | | list.add(templateExcelExport); |
| | | }); |
| | | return list; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void add(LWhFormProcureParam param, FinSysTenantUser sysTenantUser, S_user_core currentUser) { |
| | | Long warehouseId = param.getWarehouseId(); |
| | | BaseWarehouse baseWarehouse = baseWarehouseService.getById(warehouseId); |
| | | String tenantId = sysTenantUser.getTenantId(); |
| | | String tenantName = sysTenantUser.getTenantName(); |
| | | |
| | | // 采购单id |
| | | Long whFormProcureId = param.getId(); |
| | | if (whFormProcureId == null) { |
| | | whFormProcureId = IdUtil.generateId(); |
| | | } |
| | | long procureTime = Long.valueOf(param.getProcureTime()); |
| | | |
| | | Set<String> supplierList = new HashSet<>(); |
| | | |
| | | ArrayList<LWhFormProcureGoods> procureGoodList = new ArrayList<>(); |
| | | ArrayList<LWhProcureModel> procureModelList = new ArrayList<>(); |
| | | |
| | | List<LWhFormProcureGoodsInfoParam> procureGoods = param.getProcureGoods(); |
| | | for (int i = 0; i < procureGoods.size(); i++) { |
| | | LWhFormProcureGoodsInfoParam procureGoodT = procureGoods.get(i); |
| | | Long baseCategoryId = procureGoodT.getBaseCategoryId(); |
| | | Long baseGoodsTemplateId = procureGoodT.getBaseGoodsTemplateId(); |
| | | String supplier = procureGoodT.getSupplier(); |
| | | // 判断当前供应商是否已存在 |
| | | if (!supplierList.contains(supplier) && !lOrgSupplierService.supplierIsContain(tenantId, supplier)) { |
| | | supplierList.add(supplier); |
| | | } |
| | | |
| | | List<LWhProcureModelParam> models = procureGoodT.getModels(); |
| | | if (CollectionUtils.isEmpty(models)) { |
| | | throw new RuntimeException("采购单不能为空"); |
| | | } |
| | | LWhFormProcureGoods procureGood = new LWhFormProcureGoods(); |
| | | long fromProcureGoodsId = IdUtil.generateId(); |
| | | procureGood.setId(fromProcureGoodsId); |
| | | procureGood.setWhFormProcureId(whFormProcureId); |
| | | procureGood.setBaseCategoryId(baseCategoryId); |
| | | procureGood.setBaseGoodsTemplateId(baseGoodsTemplateId); |
| | | // TODO 物品历史版本 |
| | | procureGood.setGoodsTemplateName(procureGoodT.getGoodsTemplateName()); |
| | | procureGood.setSupplier(supplier); |
| | | procureGood.setSort(i); |
| | | for (LWhProcureModelParam modelT : models) { |
| | | Integer counts = modelT.getCounts(); |
| | | if (counts == null || counts <= 0) { |
| | | throw new RuntimeException("型号的采购数量只能为正整数"); |
| | | } |
| | | Long price = modelT.getPrice(); |
| | | if (price == null || price <= 0) { |
| | | throw new RuntimeException("型号的采购价格只能为正数"); |
| | | } |
| | | Long baseGoodsModelsId = modelT.getBaseGoodsModelsId(); |
| | | if (baseGoodsModelsId == null) { |
| | | throw new RuntimeException("采购的价型号未找到"); |
| | | } |
| | | // 查询型号信息 |
| | | Map<String, Object> tempGoodsInfo = baseGoodsTemplateService.queryGoodsInfoByModelId(baseGoodsModelsId); |
| | | if (tempGoodsInfo == null) { |
| | | throw new RuntimeException("采购的价型号未找到"); |
| | | } |
| | | String modelName = (String)tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(IdUtil.generateId()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | model.setBusinessId(whFormProcureId); |
| | | model.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | model.setBaseGoodsModelsName(modelName); |
| | | model.setPrice(price); |
| | | model.setCounts(counts); |
| | | model.setWorehouseCount(goodsModelNum); |
| | | model.setSupplier(supplier); |
| | | model.setTotalAmount(price * counts); |
| | | procureModelList.add(model); |
| | | } |
| | | procureGoodList.add(procureGood); |
| | | } |
| | | lWhFormProcureGoodsService.insertBatch(procureGoodList); |
| | | lWhProcureModelService.insertBatch(procureModelList); |
| | | |
| | | LWhFormProcure lWhFormProcure = |
| | | getlWhFormProcure(param, whFormProcureId, warehouseId, baseWarehouse, currentUser, procureTime); |
| | | insert(lWhFormProcure); |
| | | |
| | | supplierList.forEach(supplier -> { |
| | | LOrgSupplier lOrgSupplier = new LOrgSupplier(); |
| | | lOrgSupplier.setId(IdUtil.generateId()); |
| | | lOrgSupplier.setAgencyId(tenantId); |
| | | lOrgSupplier.setAgencyName(tenantName); |
| | | lOrgSupplier.setSupplier(supplier); |
| | | lOrgSupplierService.insert(lOrgSupplier); |
| | | }); |
| | | } |
| | | |
| | | private LWhFormProcure getlWhFormProcure(LWhFormProcureParam param, Long whFormProcureId, Long warehouseId, |
| | | BaseWarehouse baseWarehouse, S_user_core currentUser, long procureTime) { |
| | | // 插入 采购单物品【L_WH_FORM_PROCURE_GOODS】 |
| | | LWhFormProcure lWhFormProcure = new LWhFormProcure(); |
| | | lWhFormProcure.setId(whFormProcureId); |
| | | lWhFormProcure |
| | | .setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Procure_Warehouse)); |
| | | lWhFormProcure.setWarehouseId(warehouseId); |
| | | lWhFormProcure.setWarehouseName(baseWarehouse.getWarehouseName()); |
| | | lWhFormProcure.setBuyerId(currentUser.getId()); |
| | | lWhFormProcure.setBuyerName(currentUser.getNick_name()); |
| | | lWhFormProcure.setProcureTime(procureTime); |
| | | lWhFormProcure.setProcureDoc(param.getProcureDoc()); |
| | | lWhFormProcure.setBuyType(param.getBuyType()); |
| | | lWhFormProcure.setStates(1); |
| | | lWhFormProcure.setAgencyId(baseWarehouse.getAgencyId()); |
| | | lWhFormProcure.setAgencyName(baseWarehouse.getAgencyName()); |
| | | return lWhFormProcure; |
| | | } |
| | | } |
File was renamed from consum-base/src/main/java/com/consum/base/service/LWhFormScrappedServiceImpl.java |
| | |
| | | package com.consum.base.service; |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | |
| | | import com.consum.base.pojo.response.FormScrappedGoodsDetailVO; |
| | | import com.consum.base.pojo.response.FormScrappedGoodsVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.LWhFormScrappedExtendVO; |
| | | import com.consum.base.service.BaseGoodsModelsService; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.LWhFormScrappedCoreService; |
| | | import com.consum.base.service.LWhFormScrappedGoodsService; |
| | | import com.consum.base.service.LWhFormScrappedService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.SDictDataServiceImpl; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @Description 报废单 |
| | |
| | | * @Date 2023/11/1 |
| | | */ |
| | | @Service |
| | | public class LWhFormScrappedServiceImpl extends BaseServiceImpl { |
| | | public class LWhFormScrappedServiceImpl extends BaseServiceImpl implements LWhFormScrappedService { |
| | | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | |
| | | @Autowired |
| | | private LWhFormScrappedCoreService lWhFormScrappedCoreService; |
| | | |
| | | private static String QUERY_LIST = "SELECT DISTINCT fs.* FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID WHERE 1 = 1 "; |
| | | private static String QUERY_LIST = |
| | | "SELECT DISTINCT fs.* FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID WHERE 1 = 1 "; |
| | | |
| | | private static final String QUERY_BF_DETAIL_LIST = "select fs.id,fs.BUSINESS_FORM_CODE,fsg.GOODS_TEMPLATE_NAME,fsg.BASE_GOODS_MODELS_NAME,fsg.COUNTS," |
| | | + "fs.AGENCY_NAME,OPERATOR_NAME,DEAL_TIME from l_wh_form_scrapped fs " |
| | | + "inner join l_wh_form_scrapped_goods fsg on fs.ID = fsg.FORM_SCRAPPED_ID where 1=1 "; |
| | | private static final String QUERY_BF_DETAIL_LIST = |
| | | "select fs.id,fs.BUSINESS_FORM_CODE,fsg.GOODS_TEMPLATE_NAME,fsg.BASE_GOODS_MODELS_NAME,fsg.COUNTS," |
| | | + "fs.AGENCY_NAME,OPERATOR_NAME,DEAL_TIME from l_wh_form_scrapped fs " |
| | | + "inner join l_wh_form_scrapped_goods fsg on fs.ID = fsg.FORM_SCRAPPED_ID where 1=1 "; |
| | | |
| | | /** |
| | | * 新增 |
| | | * |
| | | * @param param |
| | | * @param currentUser 当前登录用户 |
| | | * @param sysInfo 当前登录用户 |
| | | * @return 1.新增报废单 2.新增报废单物品 |
| | | * @param sysInfo 当前登录用户 |
| | | * @return 1.新增报废单 2.新增报废单物品 |
| | | */ |
| | | |
| | | @Override |
| | | public int add(LWhFormScrappedParam param, S_user_core currentUser, FinSysTenantUser sysInfo) { |
| | | //1.新增报废单记录 |
| | | // 1.新增报废单记录 |
| | | LWhFormScrapped lWhFormScrapped = new LWhFormScrapped(); |
| | | //报废单id |
| | | // 报废单id |
| | | long lWhFormScrappedId = IdUtil.generateId(); |
| | | lWhFormScrapped.setId(lWhFormScrappedId); |
| | | lWhFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped)); |
| | |
| | | |
| | | // 公用 |
| | | Long warehouseId = null; |
| | | //仓库名称 |
| | | // 仓库名称 |
| | | String wareHouseName = null; |
| | | warehouseId = param.getWarehouseId(); |
| | | //根据仓库id查询仓库 |
| | | // 根据仓库id查询仓库 |
| | | BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId); |
| | | if (warehouse == null) { |
| | | log.error("仓库不存在"); |
| | |
| | | lWhFormScrapped.setDealTime(param.getDealTime()); |
| | | lWhFormScrapped.setStates(0); |
| | | lWhFormScrapped.setUploadFiles(param.getUploadFiles()); |
| | | //根据部门id查询部门 |
| | | // 根据部门id查询部门 |
| | | FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId()); |
| | | if (department != null) { |
| | | lWhFormScrapped.setDepartmentId(sysInfo.getSysDeptId()); |
| | |
| | | log.error("新增报废单失败"); |
| | | return 0; |
| | | } |
| | | //2.新增报废单物品记录 |
| | | //根据物品id查询物品 |
| | | // 2.新增报废单物品记录 |
| | | // 根据物品id查询物品 |
| | | for (LWhFormScrappedGoodsInfoParam goodsInfo : param.getScrappedGoodsInfo()) { |
| | | BaseGoodsTemplate goodsTemplate = this.baseGoodsTemplateService.get(new BaseGoodsTemplate(goodsInfo.getBaseGoodsTemplateId())); |
| | | BaseGoodsTemplate goodsTemplate = |
| | | this.baseGoodsTemplateService.get(new BaseGoodsTemplate(goodsInfo.getBaseGoodsTemplateId())); |
| | | if (goodsTemplate == null) { |
| | | log.error("该物品模板不存在"); |
| | | return 0; |
| | |
| | | log.error("新增报废单物品记录失败"); |
| | | return 0; |
| | | } |
| | | //获取规格型号id |
| | | List<Long> baseGoodsModelsIdList = scrappedGoodsParamList.stream().map(params -> params.getBaseGoodsModelsId()).collect(Collectors.toList()); |
| | | //根据规格型号id查询规格型号 |
| | | // 获取规格型号id |
| | | List<Long> baseGoodsModelsIdList = scrappedGoodsParamList.stream() |
| | | .map(params -> params.getBaseGoodsModelsId()).collect(Collectors.toList()); |
| | | // 根据规格型号id查询规格型号 |
| | | List<BaseGoodsModels> models = this.baseGoodsModelsService.selectByModelsIdList(baseGoodsModelsIdList); |
| | | if (CollectionUtils.isEmpty(models)) { |
| | | log.error("该型号商品不存在"); |
| | | return 0; |
| | | } |
| | | Map<Long, BaseGoodsModels> modelMap = models.stream().collect(Collectors.toMap(model -> model.getId(), model -> model)); |
| | | //获取报废原因code |
| | | List<String> scrappedCodeList = scrappedGoodsParamList.stream().map(params -> params.getScrappedCode()).collect(Collectors.toList()); |
| | | //根据报废原因code查询数据字典 |
| | | Map<Long, BaseGoodsModels> modelMap = |
| | | models.stream().collect(Collectors.toMap(model -> model.getId(), model -> model)); |
| | | // 获取报废原因code |
| | | List<String> scrappedCodeList = |
| | | scrappedGoodsParamList.stream().map(params -> params.getScrappedCode()).collect(Collectors.toList()); |
| | | // 根据报废原因code查询数据字典 |
| | | List<SDictData> SDictDataList = this.sDictDataService.selectByScrappedCodeList(scrappedCodeList); |
| | | Map<Long, String> scrappedNameMap = SDictDataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | Map<Long, String> scrappedNameMap = |
| | | SDictDataList.stream().collect(Collectors.toMap(s -> s.getDict_code(), s -> s.getDict_label())); |
| | | |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = new ArrayList<>(); |
| | | for (LWhFormScrappedGoodsModelParams params : scrappedGoodsParamList) { |
| | | LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods(); |
| | | scrappedGoods.setId(IdUtil.generateId()); |
| | | //根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | // 根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, |
| | | scrappedGoods.getBaseGoodsModelsId(), 1, null); |
| | | if (params.getCounts() > goodsNum) { |
| | | log.error("报废数量大于库存数量"); |
| | | return 0; |
| | | } |
| | | scrappedGoods.setCounts(params.getCounts()); |
| | | //报废原因 |
| | | // 报废原因 |
| | | scrappedGoods.setScrappedCode(params.getScrappedCode()); |
| | | scrappedGoods.setScrappedName(scrappedNameMap.get(Long.valueOf(params.getScrappedCode()))); |
| | | scrappedGoods.setFormScrappedId(lWhFormScrappedId); |
| | | //物品模板 |
| | | // 物品模板 |
| | | scrappedGoods.setBaseGoodsTemplateId(goodsTemplate.getId()); |
| | | scrappedGoods.setGoodsTemplateName(goodsTemplate.getGoodsName()); |
| | | //规格型号 |
| | | // 规格型号 |
| | | Long baseGoodsModelsId = params.getBaseGoodsModelsId(); |
| | | BaseGoodsModels baseGoodsModels = modelMap.get(baseGoodsModelsId); |
| | | if (baseGoodsModels != null) { |
| | |
| | | return 0; |
| | | } |
| | | } |
| | | //3.根据报废单报废物品 |
| | | Long lWarehouseFlowId = this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | // 3.根据报废单报废物品 |
| | | Long lWarehouseFlowId = |
| | | this.lWhFormScrappedCoreService.outFormByTransId(lWhFormScrappedId, currentUser, param.getDealTime()); |
| | | if (lWarehouseFlowId == null) { |
| | | log.error("根据出库单出库 失败"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @Override |
| | | public PageUtil queryList(LWhFormScrappedQry param, FinSysTenantUser sysInfo) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_LIST); |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append("and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append("and fsg.GOODS_TEMPLATE_NAME LIKE :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //机构 |
| | | // 机构 |
| | | sql.append("and AGENCY_ID like :agencyId "); |
| | | if (param.getAgencyId() != null) { |
| | | paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } else { |
| | | paramts.put("agencyId", sysInfo.getTenantId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //报废时间 |
| | | // 报废时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @Override |
| | | public LWhFormScrappedExtendVO getById(Long id) { |
| | | LWhFormScrappedExtendVO scrappedExtend = new LWhFormScrappedExtendVO(); |
| | | //1.查询报废单 |
| | | // 1.查询报废单 |
| | | LWhFormScrapped lWhFormScrapped = this.get(new LWhFormScrapped(id)); |
| | | if (lWhFormScrapped != null) { |
| | | BeanUtils.copyProperties(lWhFormScrapped, scrappedExtend); |
| | | } |
| | | //2.查询报废单 |
| | | // 2.查询报废单 |
| | | List<LWhFormScrappedGoods> scrappedGoodsList = this.scrappedGoodsService.getByFormScrappedId(id); |
| | | //通过baseGoodsTemplateId 进行分组 |
| | | Map<Long, List<LWhFormScrappedGoods>> map = scrappedGoodsList.stream().collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsTemplateId)); |
| | | //循环map的key和value |
| | | // 通过baseGoodsTemplateId 进行分组 |
| | | Map<Long, List<LWhFormScrappedGoods>> map = |
| | | scrappedGoodsList.stream().collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsTemplateId)); |
| | | // 循环map的key和value |
| | | List<FormScrappedGoodsVO> scrappedGoodsVO = Lists.newArrayList(); |
| | | for (Map.Entry<Long, List<LWhFormScrappedGoods>> entry : map.entrySet()) { |
| | | Long baseGoodsTemplateId = entry.getKey(); |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageUtil queryDetailList(LWhFormScrappedQry param, FinSysTenantUser sysInfo) { |
| | | StringBuilder sql = new StringBuilder(QUERY_BF_DETAIL_LIST); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | |
| | | //报废单号 |
| | | // 报废单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append("and BUSINESS_FORM_CODE =:BUSINESS_FORM_CODE "); |
| | | paramts.put("BUSINESS_FORM_CODE", param.getBusinessFormCode()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append("and GOODS_TEMPLATE_NAME like:GOODS_TEMPLATE_NAME "); |
| | | paramts.put("GOODS_TEMPLATE_NAME", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("GOODS_TEMPLATE_NAME", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //规格型号 |
| | | // 规格型号 |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("and BASE_GOODS_MODELS_ID =:BASE_GOODS_MODELS_ID "); |
| | | paramts.put("BASE_GOODS_MODELS_ID", param.getBaseGoodsModelsId()); |
| | | } |
| | | //机构 |
| | | // 机构 |
| | | sql.append("and AGENCY_ID like:AGENCY_ID "); |
| | | if (param.getAgencyId() != null) { |
| | | paramts.put("AGENCY_ID", param.getAgencyId() + StringUtils.CHAR_PERCENT); |
| | | } else { |
| | | paramts.put("AGENCY_ID", sysInfo.getTenantId() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append("and OPERATOR_NAME =:OPERATOR_NAME "); |
| | | paramts.put("OPERATOR_NAME", StringUtils.CHAR_PERCENT + param.getOperatorName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | |
| | | //结束时间 |
| | | // 结束时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | |
| | | } |
| | | |
| | | sql.append("ORDER BY DEAL_TIME DESC "); |
| | | GenericPager<Map<String, Object>> mapGenericPager = selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = |
| | | selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | PageUtil pageUtil = new PageUtil<>(mapGenericPager); |
| | | List<FormScrappedGoodsDetailVO> result = Lists.newArrayList(); |
| | | mapGenericPager.getDatas().forEach(item -> { |
| | | FormScrappedGoodsDetailVO formScrappedGoodsDetailVO = MapUtils.convertMapToObj(item, FormScrappedGoodsDetailVO.class); |
| | | FormScrappedGoodsDetailVO formScrappedGoodsDetailVO = |
| | | MapUtils.convertMapToObj(item, FormScrappedGoodsDetailVO.class); |
| | | result.add(formScrappedGoodsDetailVO); |
| | | }); |
| | | pageUtil.setDatas(result); |
| | | return pageUtil; |
| | | } |
| | | |
| | | @Override |
| | | public List<ScrappedInfoExcelTemplate> export(Long id) { |
| | | String sql = |
| | | "SELECT\n" |
| | | + "\tBUSINESS_FORM_CODE,\n" |
| | | + "\tfs.DEAL_TIME,\n" |
| | | + "\tOPERATOR_NAME,\n" |
| | | + "\tAGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_TEMPLATE_NAME templateName,\n" |
| | | + "\tBASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tCOUNTS num,\n" |
| | | + "\tSCRAPPED_NAME deception,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_form_scrapped_goods fsg\n" |
| | | + "\tLEFT JOIN l_wh_form_scrapped fs ON fs.id = fsg.FORM_SCRAPPED_ID\n" |
| | | + "WHERE\n" |
| | | + "\tfs.ID = :id\n" |
| | | + "\tAND STATES = 1"; |
| | | String sql = "SELECT\n" + "\tBUSINESS_FORM_CODE,\n" + "\tfs.DEAL_TIME,\n" + "\tOPERATOR_NAME,\n" |
| | | + "\tAGENCY_NAME tenantName,\n" + "\tGOODS_TEMPLATE_NAME templateName,\n" |
| | | + "\tBASE_GOODS_MODELS_NAME baseModelName,\n" + "\tCOUNTS num,\n" + "\tSCRAPPED_NAME deception,\n" |
| | | + "\tBEIZ remark\n" + "FROM\n" + "\tl_wh_form_scrapped_goods fsg\n" |
| | | + "\tLEFT JOIN l_wh_form_scrapped fs ON fs.id = fsg.FORM_SCRAPPED_ID\n" + "WHERE\n" + "\tfs.ID = :id\n" |
| | | + "\tAND STATES = 1"; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | |
| | | } |
| | | List<ScrappedInfoExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | ScrappedInfoExcelTemplate inventoryExcelTemplate = MapUtils.convertMapToObj(item, ScrappedInfoExcelTemplate.class); |
| | | ScrappedInfoExcelTemplate inventoryExcelTemplate = |
| | | MapUtils.convertMapToObj(item, ScrappedInfoExcelTemplate.class); |
| | | list.add(inventoryExcelTemplate); |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsTemplateCountVO> getScrappedCountByBusinessId(Long businessId) { |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = Lists.newArrayList(); |
| | | // 统计型号数量 |
| | | String sql = |
| | | "SELECT fsg.BASE_GOODS_TEMPLATE_ID id,fsg.GOODS_TEMPLATE_NAME goodsName,sum(counts) count FROM l_wh_form_scrapped fs left join l_wh_form_scrapped_goods fsg on fs.id = fsg.FORM_SCRAPPED_ID " |
| | | + "where fsg.FORM_SCRAPPED_ID =:businessId group by fsg.BASE_GOODS_TEMPLATE_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("businessId", businessId); |
| | | List<Map<String, Object>> procureModelList = this.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | GoodsTemplateCountVO goodsTemplateCountVO = MapUtils.convertMapToObj(map, GoodsTemplateCountVO.class); |
| | | goodsTemplateCount.add(goodsTemplateCountVO); |
| | | } |
| | | return goodsTemplateCount; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.utils.CurrencyUtil; |
| | |
| | | import com.consum.base.service.LWhFormTransferService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.base.service.LWhProcureModelUserRecordServiceImpl; |
| | | import com.consum.base.service.LWhProcureModelUserRecordService; |
| | | import com.consum.base.service.LWhProcureModelUserServiceImpl; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.BaseWarehouseManager; |
| | |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * @Description 调拨管理 |
| | |
| | | @Autowired |
| | | private LWhProcureModelUserServiceImpl lWhProcureModelUserService; |
| | | @Autowired |
| | | private LWhProcureModelUserRecordServiceImpl lWhProcureModelUserRecordService; |
| | | private LWhProcureModelUserRecordService lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseWarehouseManagerService baseWarehouseManagerService; |
| | | |
| | | private static String QUERY_FORM_TRANSFER_LIST = "SELECT ft.* FROM l_wh_form_transfer ft " |
| | | + "left join L_WH_PROCURE_MODEL pm on pm.BUSINESS_ID = ft.id " |
| | | + "LEFT JOIN BASE_GOODS_MODELS bgm ON pm.BASE_GOODS_MODELS_ID=bgm.ID " |
| | | + "LEFT JOIN BASE_GOODS_TEMPLATE bgt ON bgm.GOODS_TEMPLATES_ID=bgt.id WHERE 1 = 1 "; |
| | | |
| | | private static String QUERY_FORM_TRANSFER_LIST = |
| | | "SELECT ft.* FROM l_wh_form_transfer ft " + "left join L_WH_PROCURE_MODEL pm on pm.BUSINESS_ID = ft.id " |
| | | + "LEFT JOIN BASE_GOODS_MODELS bgm ON pm.BASE_GOODS_MODELS_ID=bgm.ID " |
| | | + "LEFT JOIN BASE_GOODS_TEMPLATE bgt ON bgm.GOODS_TEMPLATES_ID=bgt.id WHERE 1 = 1 "; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | * @Date 2023/10/30 |
| | | */ |
| | | public long add(LWhFormTransferParam param, FinSysTenantUser sysInfo) throws Exception { |
| | | //1.新增调拨单记录 |
| | | // 1.新增调拨单记录 |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(); |
| | | //调拨单id |
| | | // 调拨单id |
| | | long lWhFormTransferId = IdUtil.generateId(); |
| | | lWhFormTransfer.setId(lWhFormTransferId); |
| | | |
| | |
| | | Long warehouseId = param.getInWarehouseId(); |
| | | // 调拨类型单据 |
| | | if (businessType == 0) { |
| | | //入库仓库为当前用户的默认仓库 |
| | | // 入库仓库为当前用户的默认仓库 |
| | | String tenantId = sysInfo.getTenantId(); |
| | | String tenantName = sysInfo.getTenantName(); |
| | | BaseWarehouse warehouse = baseWarehouseService.getDefaultWarehouseByAgencyId(Long.valueOf(tenantId)); |
| | |
| | | lWhFormTransfer.setInAgencyId(Long.valueOf(tenantId)); |
| | | lWhFormTransfer.setInAgencyName(tenantName); |
| | | } |
| | | //当业务类型为部门分发时 添加部门分发记录和使用人 |
| | | // 当业务类型为部门分发时 添加部门分发记录和使用人 |
| | | if (businessType == 1) { |
| | | //部门分发类型 出库仓库类型0机构1部门 |
| | | //从当前登录库管人从库中出库,入到所选部门的下 |
| | | // 部门分发类型 出库仓库类型0机构1部门 |
| | | // 从当前登录库管人从库中出库,入到所选部门的下 |
| | | |
| | | //查询库管员信息和相关仓库 |
| | | // 查询库管员信息和相关仓库 |
| | | Long id = sysInfo.getId(); |
| | | BaseWarehouseManager manager = new BaseWarehouseManager(); |
| | | manager.setManagerId(id); |
| | |
| | | } |
| | | } |
| | | |
| | | //根据机构id查询调拨机构 |
| | | // 根据机构id查询调拨机构 |
| | | FinSysTenant finSysTenant = finSysTenantService.get(new FinSysTenant(param.getOutAgencyId())); |
| | | if (finSysTenant == null) { |
| | | log.error("调拨机构不存在"); |
| | |
| | | lWhFormTransfer.setOperatorId(sysInfo.getId()); |
| | | lWhFormTransfer.setOperatorName(sysInfo.getUserName()); |
| | | lWhFormTransfer.setCreateTime(param.getCreateTime()); |
| | | //0=待出库;1=待接收;2=已入库库:4=已撤销 |
| | | // 0=待出库;1=待接收;2=已入库库:4=已撤销 |
| | | lWhFormTransfer.setStates(0); |
| | | lWhFormTransfer.setProcureDoc(param.getProcureDoc()); |
| | | |
| | |
| | | log.error("新增调拨单失败"); |
| | | } |
| | | |
| | | //2.新增物品型号记录 |
| | | // 2.新增物品型号记录 |
| | | List<LWhFormTransferGoodsInfoParam> transferGoods = param.getTransferGoods(); |
| | | List<LWhProcureModel> modelList = new ArrayList<>(); |
| | | for (LWhFormTransferGoodsInfoParam transferGoodsInfo : transferGoods) { |
| | |
| | | Long baseGoodsModelsId = model.getBaseGoodsModelsId(); |
| | | if (businessType == 0) { |
| | | lWhProcureModel.setBusinessType(2); |
| | | //根据物品型号查询物品库存 |
| | | // 根据物品型号查询物品库存 |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | } |
| | |
| | | lWhProcureModel.setUseCount(model.getCounts()); |
| | | lWhProcureModel.setBusinessId(lWhFormTransferId); |
| | | lWhProcureModel.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | //根据型号id查询型号 |
| | | List<Map<String, Object>> baseGoodsModels = this.baseGoodsModelsService.queryGoodsModelInfo(baseGoodsModelsId); |
| | | // 根据型号id查询型号 |
| | | List<Map<String, Object>> baseGoodsModels = |
| | | this.baseGoodsModelsService.queryGoodsModelInfo(baseGoodsModelsId); |
| | | Map<String, Object> baseModelMap = baseGoodsModels.get(0); |
| | | if (baseGoodsModels != null && !CollectionUtils.isEmpty(baseModelMap)) { |
| | | Object modelName = baseModelMap.get("modelName"); |
| | |
| | | } |
| | | lWhProcureModel.setSupplier(transferGoodsInfo.getSupplier()); |
| | | |
| | | //3.当业务类型为部门分发时 添加部门分发记录和使用人 |
| | | // 3.当业务类型为部门分发时 添加部门分发记录和使用人 |
| | | // 单据类型 1 采购2 调拨 3出库4部门分发 |
| | | //部门分发类型 |
| | | // 部门分发类型 |
| | | if (businessType == 1 && "A".equals(baseModelMap.get("type"))) { |
| | | LWhProcureModelUserRecord lWhProcureModelUserRecord = new LWhProcureModelUserRecord(); |
| | | lWhProcureModelUserRecord.setId(IdUtil.generateId()); |
| | |
| | | return lWhFormTransferId; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | * @Author 卢庆阳 |
| | |
| | | public GenericPager<LWhFormTransfer> queryFormTransferList(TransferQry param) { |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(QUERY_FORM_TRANSFER_LIST); |
| | | //调拨单号 |
| | | // 调拨单号 |
| | | if (!StringUtils.isEmpty(param.getBusinessFormCode())) { |
| | | sql.append(" and BUSINESS_FORM_CODE = :businessFormCode "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | |
| | | sql.append("and ft.BUSINESS_TYPE = :businessType "); |
| | | paramts.put("businessType", param.getQryType()); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (!StringUtils.isEmpty(param.getGoodsTemplateName())) { |
| | | sql.append("AND bgt.GOODS_NAME LIKE :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", |
| | | StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //调拨机构 |
| | | // 调拨机构 |
| | | if (param.getOutAgencyId() != null) { |
| | | sql.append(" and OUT_AGENCY_ID = :OUT_AGENCY_ID "); |
| | | paramts.put("OUT_AGENCY_ID", param.getOutAgencyId()); |
| | | } |
| | | //接收机构 |
| | | // 接收机构 |
| | | if (param.getInAgencyId() != null) { |
| | | sql.append(" and IN_AGENCY_ID = :IN_AGENCY_ID "); |
| | | paramts.put("IN_AGENCY_ID", param.getInAgencyId()); |
| | | } |
| | | //状态 |
| | | // 状态 |
| | | if (param.getStates() != null) { |
| | | sql.append(" and ft.states =:states "); |
| | | paramts.put("states", param.getStates()); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (!StringUtils.isEmpty(param.getOperatorName())) { |
| | | sql.append(" and OPERATOR_NAME =:OPERATOR_NAME "); |
| | | paramts.put("OPERATOR_NAME", param.getOperatorName()); |
| | | } |
| | | //申请时间 |
| | | // 申请时间 |
| | | if (param.getCreateTimeStart() != null) { |
| | | sql.append(" and ft.CREATE_TIME >=:createTimeStart "); |
| | | paramts.put("createTimeStart", param.getCreateTimeStart() * 1000000); |
| | |
| | | sql.append(" and ft.CREATE_TIME <:createTimeEnd "); |
| | | paramts.put("createTimeEnd", param.getCreateTimeEnd() * 1000000 + 240000); |
| | | } |
| | | //接收时间 |
| | | // 接收时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append(" and IN_TIME >=:inTimeStart "); |
| | | paramts.put("inTimeStart", param.getStartTime() * 1000000); |
| | |
| | | sql.append(" and IN_TIME <:inTimeEnd "); |
| | | paramts.put("inTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | //分发部门 |
| | | // 分发部门 |
| | | if (param.getInWarehouseId() != null) { |
| | | sql.append("and ft.IN_WAREHOUSE_ID = :inWarehouseId "); |
| | | paramts.put("inWarehouseId", param.getInWarehouseId()); |
| | |
| | | */ |
| | | public LWHFromTransferExtendVO getById(Long id) { |
| | | LWHFromTransferExtendVO result = new LWHFromTransferExtendVO(); |
| | | //1.查询调拨单 |
| | | // 1.查询调拨单 |
| | | LWhFormTransfer lWhFormTransfer = this.get(new LWhFormTransfer(id)); |
| | | if (lWhFormTransfer != null) { |
| | | BeanUtils.copyProperties(lWhFormTransfer, result); |
| | |
| | | |
| | | String sql = "SELECT bgt.id, CATEGORY_ID, CATEGORY_NAME, GOODS_NAME,bgt.CLASSIFICATION type " |
| | | + "FROM l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " + "WHERE pm.BUSINESS_ID =:id GROUP BY bgt.id "; |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " |
| | | + "WHERE pm.BUSINESS_ID =:id GROUP BY bgt.id "; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", result.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhFormOutputService.select(sql, paramMap, new MapperUtil()); |
| | | |
| | | String queryRecord = "SELECT * FROM l_wh_procure_model_user_record where TRANS_BUSINESS_ID = :id order by DEAL_TIME desc limit 1"; |
| | | LWhProcureModelUserRecord lWhProcureModelUserRecord = lWhProcureModelUserRecordService.get(queryRecord, paramMap, new LWhProcureModelUserRecord()); |
| | | String queryRecord = |
| | | "SELECT * FROM l_wh_procure_model_user_record where TRANS_BUSINESS_ID = :id order by DEAL_TIME desc limit 1"; |
| | | LWhProcureModelUserRecord lWhProcureModelUserRecord = |
| | | lWhProcureModelUserRecordService.get(queryRecord, paramMap, new LWhProcureModelUserRecord()); |
| | | List<FormTransferGoodsVO> formTransferGoods = Lists.newArrayList(); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FormTransferGoodsVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FormTransferGoodsVO.class); |
| | |
| | | List<GoodsModelVO> goodsModelVOList = Lists.newArrayList(); |
| | | String sql2 = "SELECT pm.id,pm.BASE_GOODS_MODELS_NAME,bgm.UNIT,COUNTS,total_amount " |
| | | + "FROM l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " + "WHERE pm.BUSINESS_ID =:id and bgt.id =:baseGoodsTemplateId"; |
| | | + "LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " |
| | | + "WHERE pm.BUSINESS_ID =:id and bgt.id =:baseGoodsTemplateId"; |
| | | Map<String, Object> goodsModelParamMap = new HashMap<>(); |
| | | goodsModelParamMap.put("id", result.getId()); |
| | | goodsModelParamMap.put("baseGoodsTemplateId", baseGoodsTemplateId); |
| | | List<Map<String, Object>> modelList = lWhFormOutputService.select(sql2, goodsModelParamMap, new MapperUtil()); |
| | | List<Map<String, Object>> modelList = |
| | | lWhFormOutputService.select(sql2, goodsModelParamMap, new MapperUtil()); |
| | | modelList.forEach(item -> { |
| | | GoodsModelVO goodsModelVO = MapUtils.convertMapToObj(item, GoodsModelVO.class); |
| | | Integer businessType = result.getBusinessType(); |
| | | String type = procureTemplateInfoVO.getType(); |
| | | //部门分发需要查询使用信息 |
| | | // 部门分发需要查询使用信息 |
| | | if (businessType == 1 && "A".equals(type)) { |
| | | Long procureModelId = goodsModelVO.getId(); |
| | | LWhProcureModelUser lWhProcureModelUser = new LWhProcureModelUser(); |
| | | lWhProcureModelUser.setWhProcureModelId(procureModelId); |
| | | lWhProcureModelUser.setProcureModelUserRecordId(lWhProcureModelUserRecord.getId()); |
| | | List<LWhProcureModelUser> procureModelUserList = this.lWhProcureModelUserService.select(lWhProcureModelUser); |
| | | List<LWhProcureModelUser> procureModelUserList = |
| | | this.lWhProcureModelUserService.select(lWhProcureModelUser); |
| | | if (!CollectionUtils.isEmpty(procureModelUserList)) { |
| | | List<DepartGoodsUseInfo> departGoodsUseInfoList = Lists.newArrayList(); |
| | | procureModelUserList.forEach(useInfo -> { |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 导出调拨出库单 |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | public List<TransferExcelTemplate> export(Long id, Integer type) { |
| | | String sql = "SELECT\n" |
| | | + "\tft.BUSINESS_FORM_CODE,\n" |
| | | + "\tft.OPERATOR_NAME,\n" |
| | | + "\tft.CREATE_TIME,\n" |
| | | + "\tft.IN_AGENCY_NAME,\n" |
| | | + "\tft.OUT_AGENCY_NAME,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tpm.COUNTS num,\n" |
| | | + "\tpm.total_amount,\n" |
| | | + "\tft.BEIZ1 remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_form_transfer ft\n" |
| | | String sql = "SELECT\n" + "\tft.BUSINESS_FORM_CODE,\n" + "\tft.OPERATOR_NAME,\n" + "\tft.CREATE_TIME,\n" |
| | | + "\tft.IN_AGENCY_NAME,\n" + "\tft.OUT_AGENCY_NAME,\n" + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" + "\tpm.COUNTS num,\n" + "\tpm.total_amount,\n" |
| | | + "\tft.BEIZ1 remark\n" + "FROM\n" + "\tl_wh_form_transfer ft\n" |
| | | + "\tINNER JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID\n" |
| | | + "\tINNER JOIN base_goods_models bgm ON bgm.ID = pm.BASE_GOODS_MODELS_ID\n" |
| | | + "\tINNER JOIN base_goods_template bgt ON bgt.ID = bgm.GOODS_TEMPLATES_ID\n" |
| | | + "WHERE\n" |
| | | + "\tft.id = :id"; |
| | | + "\tINNER JOIN base_goods_template bgt ON bgt.ID = bgm.GOODS_TEMPLATES_ID\n" + "WHERE\n" + "\tft.id = :id"; |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | paramts.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, paramts, new MapperUtil()); |
| | |
| | | StringBuilder sql = new StringBuilder( |
| | | "SELECT ft.id,ft.BUSINESS_FORM_CODE,bgt.GOODS_NAME,bgt.CLASSIFICATION type,bgm.id goodsModelId,bgm.MODEL_NAME goodsModelName,pm.COUNTS goodsCount,fst.`name` tenantName," |
| | | + "ft.IN_WAREHOUSE_NAME departmentName,ft.OPERATOR_ID,ft.CREATE_TIME,ft.OPERATOR_NAME FROM l_wh_form_transfer ft " |
| | | + "inner JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID " + "inner JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "inner JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID " |
| | | + "inner JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "inner JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " |
| | | + "inner JOIN fin_sys_tenant_user fstu ON fstu.id = ft.OPERATOR_ID " |
| | | + "inner JOIN fin_sys_tenant_department fstd ON fstu.SYS_DEPT_ID = fstd.ID " |
| | | + "inner JOIN fin_sys_tenant fst ON fst.id = fstd.TENANT_ID where ft.BUSINESS_TYPE =1 "); |
| | | //单号 |
| | | // 单号 |
| | | if (StringUtils.isNotEmpty(transferQry.getBusinessFormCode())) { |
| | | sql.append("AND BUSINESS_FORM_CODE like :businessFormCode "); |
| | | paramts.put("businessFormCode", StringUtils.CHAR_PERCENT + transferQry.getBusinessFormCode() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("businessFormCode", |
| | | StringUtils.CHAR_PERCENT + transferQry.getBusinessFormCode() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | //物品名称 |
| | | // 物品名称 |
| | | if (StringUtils.isNotEmpty(transferQry.getGoodsTemplateName())) { |
| | | sql.append("AND bgt.GOODS_NAME like:goodsName "); |
| | | paramts.put("goodsName", StringUtils.CHAR_PERCENT + transferQry.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsName", |
| | | StringUtils.CHAR_PERCENT + transferQry.getGoodsTemplateName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | // 规格型号 |
| | | if (transferQry.getBaseGoodsModelsId() != null) { |
| | | sql.append("AND bgm.id =:goodsModelId "); |
| | | paramts.put("goodsModelId", transferQry.getBaseGoodsModelsId()); |
| | | } |
| | | //调拨机构 |
| | | // 调拨机构 |
| | | if (transferQry.getOutAgencyId() != null) { |
| | | sql.append("AND OUT_AGENCY_ID = :OUT_AGENCY_ID "); |
| | | paramts.put("OUT_AGENCY_ID", transferQry.getOutAgencyId()); |
| | | } |
| | | //分发部门 |
| | | // 分发部门 |
| | | if (transferQry.getInWarehouseId() != null) { |
| | | sql.append("and ft.IN_WAREHOUSE_ID = :inWarehouseId "); |
| | | paramts.put("inWarehouseId", transferQry.getInWarehouseId()); |
| | | } |
| | | //创建人 |
| | | // 创建人 |
| | | if (StringUtils.isNotEmpty(transferQry.getOperatorName())) { |
| | | sql.append("AND ft.OPERATOR_NAME =:OPERATOR_NAME "); |
| | | paramts.put("OPERATOR_NAME", transferQry.getOperatorName()); |
| | | } |
| | | //申请时间 |
| | | // 申请时间 |
| | | if (transferQry.getStartTime() != null) { |
| | | sql.append("AND ft.CREATE_TIME >=:createTimeStart "); |
| | | paramts.put("createTimeStart", transferQry.getStartTime() * 1000000); |
| | |
| | | } |
| | | sql.append("ORDER BY ft.CREATE_TIME DESC"); |
| | | |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), paramts, transferQry.getPageNum(), transferQry.getPageSize(), |
| | | new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), paramts, |
| | | transferQry.getPageNum(), transferQry.getPageSize(), new MapperUtil()); |
| | | |
| | | return mapGenericPager; |
| | | } |
| | | |
| | | |
| | | public GenericPager<Map<String, Object>> queryFormTransferDetailList(TransferQry param) { |
| | | |
| | | HashMap<String, Object> params = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder( |
| | | "SELECT ft.id,\n" + " ft.BUSINESS_FORM_CODE,\n" + " bgt.GOODS_NAME,\n" + " bgt.CLASSIFICATION,\n" |
| | | + " pm.BASE_GOODS_MODELS_NAME,\n" + " pm.COUNTS,\n" + " ft.IN_AGENCY_NAME,\n" + " ft.OPERATOR_NAME,\n" |
| | | + " ft.CREATE_TIME,\n" + " ft.IN_TIME,\n" + " ft.OUT_AGENCY_NAME,\n" + " ft.OUT_OPERATOR_NAME,\n" |
| | | + " ft.OUTPUT_TIME\n" + "FROM l_wh_form_transfer ft\n" + " LEFT JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID\n" |
| | | + " LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID\n" |
| | | + " LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID where 1=1 "); |
| | | StringBuilder sql = new StringBuilder("SELECT ft.id,\n" + " ft.BUSINESS_FORM_CODE,\n" |
| | | + " bgt.GOODS_NAME,\n" + " bgt.CLASSIFICATION,\n" + " pm.BASE_GOODS_MODELS_NAME,\n" |
| | | + " pm.COUNTS,\n" + " ft.IN_AGENCY_NAME,\n" + " ft.OPERATOR_NAME,\n" |
| | | + " ft.CREATE_TIME,\n" + " ft.IN_TIME,\n" + " ft.OUT_AGENCY_NAME,\n" |
| | | + " ft.OUT_OPERATOR_NAME,\n" + " ft.OUTPUT_TIME\n" + "FROM l_wh_form_transfer ft\n" |
| | | + " LEFT JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID\n" |
| | | + " LEFT JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID\n" |
| | | + " LEFT JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID where 1=1 "); |
| | | if (StringUtils.isNotEmpty(param.getBusinessFormCode())) { |
| | | sql.append("AND ft.BUSINESS_FORM_CODE = :businessFormCode "); |
| | | params.put("businessFormCode", param.getBusinessFormCode()); |
| | |
| | | sql.append("AND ft.OPERATOR_NAME = :operatorName "); |
| | | params.put("operatorName", param.getOperatorName()); |
| | | } |
| | | //申请创建时间 |
| | | // 申请创建时间 |
| | | if (param.getCreateTimeStart() != null) { |
| | | sql.append("AND ft.CREATE_TIME >= :createTimeStart "); |
| | | params.put("createTimeStart", param.getCreateTimeStart() * 1000000); |
| | |
| | | sql.append("AND ft.CREATE_TIME < :createTimeEnd "); |
| | | params.put("createTimeEnd", param.getCreateTimeEnd() * 1000000 + 240000); |
| | | } |
| | | //接收时间 |
| | | // 接收时间 |
| | | if (param.getStartTime() != null) { |
| | | sql.append("AND ft.IN_TIME >= :createTimeStart "); |
| | | params.put("createTimeStart", param.getStartTime() * 1000000); |
| | |
| | | sql.append("AND ft.IN_TIME < :createTimeEnd "); |
| | | params.put("createTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), params, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = |
| | | this.selectSplit(sql.toString(), params, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | return mapGenericPager; |
| | | |
| | | } |
| | | |
| | | public List<Map<String, Object>> queryDepartmentTransferOrder() { |
| | | |
| | | String sql = |
| | | "SELECT ft.id,\n" + " ft.BUSINESS_FORM_CODE,\n" + " gr.GOODS_TEMPLATE_NAME,\n" + " gr.BASE_GOODS_TEMPLATE_ID goodsTemplateId,\n" |
| | | + " ft.CREATE_TIME\n" + "\n" + "FROM l_wh_form_transfer ft\n" + " LEFT JOIN L_WAREHOUSE_FLOW wf ON ft.id = wf.BUSINESS_FORM_ID\n" |
| | | + " left join L_WH_GOODS_RECORD gr on gr.WAREHOUSE_FLOW_ID = wf.id\n" |
| | | + " LEFT JOIN L_GOODS_WH_RECORD gwr on gwr.WAREHOUSE_FLOW_ID = wf.id\n" |
| | | + " left join L_WH_GOODS g on g.id = gwr.WH_GOODS_ID where ft.BUSINESS_TYPE = 1 GROUP BY gr.BASE_GOODS_TEMPLATE_ID \n"; |
| | | String sql = "SELECT ft.id,\n" + " ft.BUSINESS_FORM_CODE,\n" + " gr.GOODS_TEMPLATE_NAME,\n" |
| | | + " gr.BASE_GOODS_TEMPLATE_ID goodsTemplateId,\n" + " ft.CREATE_TIME\n" + "\n" |
| | | + "FROM l_wh_form_transfer ft\n" + " LEFT JOIN L_WAREHOUSE_FLOW wf ON ft.id = wf.BUSINESS_FORM_ID\n" |
| | | + " left join L_WH_GOODS_RECORD gr on gr.WAREHOUSE_FLOW_ID = wf.id\n" |
| | | + " LEFT JOIN L_GOODS_WH_RECORD gwr on gwr.WAREHOUSE_FLOW_ID = wf.id\n" |
| | | + " left join L_WH_GOODS g on g.id = gwr.WH_GOODS_ID where ft.BUSINESS_TYPE = 1 GROUP BY gr.BASE_GOODS_TEMPLATE_ID \n"; |
| | | HashMap<String, Object> param = new HashMap<>(); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | select.forEach(item -> { |
New file |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.service.LWhGoodsRecordService; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @ClassName LWhGoodsRecordService |
| | | |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhGoodsRecordServiceImpl extends BaseServiceImpl implements LWhGoodsRecordService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @ClassName LWhProcureModelService |
| | | * @Date 2023/10/24 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhProcureModelServiceImpl extends BaseServiceImpl implements LWhProcureModelService { |
| | | |
| | | private static String GET_MODEL_BY_FORM = "SELECT * FROM L_WH_PROCURE_MODEL WHERE 1=1 "; |
| | | |
| | | /** |
| | | * 通过单据类型 单据ID查询该订单关联的设备型号以及数量 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<LWhProcureModel> getModelByForm(WhBusinessEnum businessType, Long businessId) { |
| | | StringBuilder sql = new StringBuilder(GET_MODEL_BY_FORM); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | // 项目阶段id |
| | | if (businessType != null) { |
| | | sql.append(" and BUSINESS_TYPE=:businessType "); |
| | | paramts.put("businessType", businessType.getValue()); |
| | | } |
| | | if (businessId != null) { |
| | | sql.append(" and BUSINESS_ID=:businessId "); |
| | | paramts.put("businessId", businessId); |
| | | } |
| | | return this.select(sql.toString(), paramts, new LWhProcureModel()); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门、物品查询调拨单 |
| | | * |
| | | * @param goodsTemplateId 物品ID |
| | | * @param departmentId 部门ID |
| | | * @return |
| | | */ |
| | | private static String GET_FF_ORDER_BY_GOODS_ID_AND_DEPT = |
| | | "SELECT trans.ID TRANS_BUSINESS_ID,trans.BUSINESS_FORM_CODE,baseTemp.ID BASE_GOODS_TEMPLATE_ID,baseTemp.GOODS_NAME BASE_GOODS_TEMPLATE_NAME,sum(proModel.COUNTS) total_count,sum(proModel.USE_COUNT) use_count,trans.IN_TIME FROM L_WH_FORM_TRANSFER trans LEFT JOIN L_WH_PROCURE_MODEL proModel ON proModel.BUSINESS_ID=trans.id LEFT JOIN BASE_GOODS_MODELS baseModel ON proModel.BASE_GOODS_MODELS_ID=baseModel.id LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseTemp.id=baseModel.GOODS_TEMPLATES_ID WHERE proModel.BUSINESS_TYPE=4 AND proModel.USE_COUNT> 0 "; |
| | | private static String GET_FF_ORDER_BY_GOODS_ID_AND_DEPT_END = |
| | | " GROUP BY trans.ID,trans.BUSINESS_FORM_CODE,baseTemp.ID,baseTemp.GOODS_NAME,trans.IN_TIME order by trans.BUSINESS_FORM_CODE desc"; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFfOrderByGoodsIdAndDept(Long goodsTemplateId, Long departmentId) { |
| | | StringBuilder sql = new StringBuilder(GET_FF_ORDER_BY_GOODS_ID_AND_DEPT); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | // 项目阶段id |
| | | if (goodsTemplateId != null) { |
| | | sql.append(" AND baseTemp.ID=:goodsTemplateId "); |
| | | paramts.put("goodsTemplateId", goodsTemplateId); |
| | | } |
| | | if (departmentId != null) { |
| | | sql.append(" AND trans.IN_WAREHOUSE_TYPE=1 and trans.IN_WAREHOUSE_ID=:departmentId "); |
| | | paramts.put("departmentId", departmentId); |
| | | } |
| | | return select(sql.append(GET_FF_ORDER_BY_GOODS_ID_AND_DEPT_END).toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门、物品查询调拨单 |
| | | * |
| | | * @param goodsTemplateId 物品ID |
| | | * @param departmentId 分发单ID |
| | | * @return |
| | | */ |
| | | private static String GET_GOODS_USE_INFO_BY_FF_ORDER_AND_GOOD_ID = |
| | | "SELECT baseModel.GOODS_TEMPLATES_ID,proModel.BASE_GOODS_MODELS_ID,baseModel.MODEL_NAME,baseModel.UNIT,CONCAT(baseCate.CLASSIFICATION,'类') CLASSIFICATION,modelUser.id MODEL_USER_id,modelUser.NOW_USER_PHONE,modelUser.NOW_USER_NAME,CASE WHEN modelUser.id IS NULL THEN proModel.USE_COUNT ELSE modelUser.USE_COUNT END AS user_Use_Count,CASE WHEN modelUser.id IS NULL THEN proModel.COUNTS ELSE modelUser.GOODS_NUM END AS GOODS_NUM FROM L_WH_PROCURE_MODEL proModel LEFT JOIN BASE_GOODS_MODELS baseModel ON proModel.BASE_GOODS_MODELS_ID=baseModel.id LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseTemp.id=baseModel.GOODS_TEMPLATES_ID LEFT JOIN BASE_CATEGORY baseCate ON baseCate.id=baseTemp.CATEGORY_ID LEFT JOIN L_WH_PROCURE_MODEL_USER modelUser ON modelUser.WH_PROCURE_MODEL_ID=proModel.id WHERE proModel.BUSINESS_TYPE=4 AND proModel.USE_COUNT> 0 "; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getGoodsUseInfoByFfOrderAndGoodId(Long goodsTemplateId, Long transBusinessId) { |
| | | StringBuilder sql = new StringBuilder(GET_GOODS_USE_INFO_BY_FF_ORDER_AND_GOOD_ID); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | if (goodsTemplateId != null) { |
| | | sql.append(" AND baseModel.GOODS_TEMPLATES_ID=:goodsTemplateId "); |
| | | paramts.put("goodsTemplateId", goodsTemplateId); |
| | | } |
| | | if (transBusinessId != null) { |
| | | sql.append(" AND proModel.BUSINESS_ID=:transBusinessId "); |
| | | paramts.put("transBusinessId", transBusinessId); |
| | | } |
| | | return select(sql.toString(), paramts, new MapperUtil()); |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsTemplateCountVO> getGoodsTemplateCountByBusinessId(Long businessId) { |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = Lists.newArrayList(); |
| | | |
| | | // 查询型号数量 |
| | | String sql = "SELECT bgt.id,goods_name,sum(counts) count FROM " |
| | | + "l_wh_procure_model pm LEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id " |
| | | + "LEFT JOIN base_goods_template bgt ON bgm.goods_templates_id = bgt.id " |
| | | + "WHERE pm.business_id =:businessId GROUP BY bgm.goods_templates_id"; |
| | | |
| | | HashMap<String, Object> param = new HashMap<>(); |
| | | param.put("businessId", businessId); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | select.forEach(item -> { |
| | | GoodsTemplateCountVO goodsModelVO = MapUtils.convertMapToObj(item, GoodsTemplateCountVO.class); |
| | | goodsTemplateCount.add(goodsModelVO); |
| | | }); |
| | | |
| | | return goodsTemplateCount; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsTemplateCountVO> getProcureCountByBusinessId(Long businessId) { |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = Lists.newArrayList(); |
| | | // 查询采购型号统计数量 |
| | | String sql = "select fpg.id,BASE_GOODS_TEMPLATE_ID,GOODS_TEMPLATE_NAME ,sum(counts) count " |
| | | + "from L_WH_FORM_PROCURE_GOODS fpg left join L_WH_PROCURE_MODEL pm on fpg.id = pm.FROM_PROCURE_GOODS_ID " |
| | | + "where fpg.WH_FORM_PROCURE_ID =:businessId group by pm.FROM_PROCURE_GOODS_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("businessId", businessId); |
| | | List<Map<String, Object>> procureModelList = this.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | GoodsTemplateCountVO goodsTemplateCountVO = MapUtils.convertMapToObj(map, GoodsTemplateCountVO.class); |
| | | goodsTemplateCount.add(goodsTemplateCountVO); |
| | | } |
| | | return goodsTemplateCount; |
| | | } |
| | | } |
File was renamed from consum-base/src/main/java/com/consum/base/service/LWhProcureModelUserRecordServiceImpl.java |
| | |
| | | package com.consum.base.service; |
| | | package com.consum.base.service.impl; |
| | | |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.service.LWhProcureModelUserRecordService; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | |
| | | /** |
| | | * @ClassName LWhProcureModelUserRecordServiceImpl |
| | |
| | | * @Version 1.0 |
| | | **/ |
| | | @Service |
| | | public class LWhProcureModelUserRecordServiceImpl extends BaseServiceImpl { |
| | | |
| | | public class LWhProcureModelUserRecordServiceImpl extends BaseServiceImpl implements LWhProcureModelUserRecordService { |
| | | |
| | | } |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.service.UsingFormBackModelService; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author asus |
| | |
| | | @Service |
| | | public class UsingFormBackModelServiceImpl extends BaseServiceImpl implements UsingFormBackModelService { |
| | | |
| | | @Override |
| | | public List<GoodsTemplateCountVO> getUsingCountByBusinessId(Long businessId) { |
| | | List<GoodsTemplateCountVO> goodsTemplateCount = Lists.newArrayList(); |
| | | // 统计型号数量 |
| | | StringBuilder countSql = |
| | | new StringBuilder("SELECT ufbg.BASE_GOODS_TEMPLATE_NAME,sum(ufbm.COUNTS) count,ufbm.UNIT " |
| | | + "FROM using_form_back_goods ufbg " |
| | | + "LEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID " |
| | | + "where ufbg.USING_FORM_BACK_ID = :businessId group by ufbg.BASE_GOODS_TEMPLATE_ID "); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("businessId", businessId); |
| | | List<Map<String, Object>> procureModelList = this.select(countSql.toString(), paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | GoodsTemplateCountVO goodsTemplateCountVO = MapUtils.convertMapToObj(map, GoodsTemplateCountVO.class); |
| | | goodsTemplateCount.add(goodsTemplateCountVO); |
| | | } |
| | | return goodsTemplateCount; |
| | | } |
| | | } |
| | |
| | | package com.consum.base.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.DepUsingFormBackCoreServiceImpl; |
| | |
| | | import com.consum.base.pojo.request.UsingFormBackGoodsInfo; |
| | | import com.consum.base.pojo.request.UsingFormBackParam; |
| | | import com.consum.base.pojo.request.baseGoodModel; |
| | | import com.consum.base.pojo.response.BaseGoodsTemplateInfo; |
| | | import com.consum.base.pojo.response.GoodsTemplateCountVO; |
| | | import com.consum.base.pojo.response.UseInfo; |
| | | import com.consum.base.pojo.response.UsingFormBackDetailListVO; |
| | | import com.consum.base.pojo.response.UsingFormBackDetailVO; |
| | |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * @author asus |
| | |
| | | private LWhFormTransferService lWhFormTransferService; |
| | | @Resource |
| | | private DepUsingFormBackCoreServiceImpl depUsingFormBackCoreService; |
| | | @Resource |
| | | private UsingFormBackModelService UsingFormBackModelService; |
| | | |
| | | @Override |
| | | public void add(UsingFormBackParam usingFormBackParam, FinSysTenantUser sysInfo, S_user_core currentUser) { |
| | |
| | | String departmentName = department.getName(); |
| | | |
| | | // 添加退回表单 |
| | | Long usingFormBackId = addUsingFormBack(sysInfo, departmentId, departmentName, operatorId, operatorName, backTime, procureDoc); |
| | | Long usingFormBackId = |
| | | addUsingFormBack(sysInfo, departmentId, departmentName, operatorId, operatorName, backTime, procureDoc); |
| | | |
| | | // 批量插入退回商品和退回商品模型 |
| | | List<UsingFormBackGoods> goodsBatch = new ArrayList<>(); |
| | |
| | | goodsBatch.add(goods); |
| | | |
| | | for (baseGoodModel model : goodsInfo.getModels()) { |
| | | UsingFormBackModel formModel = createUsingFormBackModel(usingFormBackId, goods.getId(), goodsInfo, model); |
| | | UsingFormBackModel formModel = |
| | | createUsingFormBackModel(usingFormBackId, goods.getId(), goodsInfo, model); |
| | | modelBatch.add(formModel); |
| | | } |
| | | } |
| | |
| | | usingFormBackModelService.insertBatch(goodsBatch); |
| | | usingFormBackGoodsService.insertBatch(modelBatch); |
| | | |
| | | depUsingFormBackCoreService.updateBack(usingFormBackId, currentUser, DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | depUsingFormBackCoreService.updateBack(usingFormBackId, currentUser, |
| | | DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | } |
| | | |
| | | private UsingFormBackGoods createUsingFormBackGoods(Long usingFormBackId, UsingFormBackGoodsInfo goodsInfo) { |
| | |
| | | return goods; |
| | | } |
| | | |
| | | private UsingFormBackModel createUsingFormBackModel(Long usingFormBackId, Long usingFormBackGoodsId, UsingFormBackGoodsInfo goodsInfo, |
| | | baseGoodModel model) { |
| | | private UsingFormBackModel createUsingFormBackModel(Long usingFormBackId, Long usingFormBackGoodsId, |
| | | UsingFormBackGoodsInfo goodsInfo, baseGoodModel model) { |
| | | UsingFormBackModel formModel = new UsingFormBackModel(); |
| | | formModel.setId(IdUtil.generateId()); |
| | | formModel.setUsingFormBackId(usingFormBackId); |
| | |
| | | return formModel; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageUtil selectPageByList(UsingFormBackQry usingFormBackParam) { |
| | | |
| | | StringBuilder sql = new StringBuilder("SELECT\n" |
| | | + "\tDISTINCT ufb.ID,\n" |
| | | + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufb.DEPARTMENT_NAME,\n" |
| | | + "\tufb.OPERATOR_NAME,\n" |
| | | + "\tufb.DEAL_TIME\n" |
| | | + "FROM\n" |
| | | + "\tusing_form_back ufb\n" |
| | | + "\tLEFT JOIN using_form_back_goods ufbg ON ufb.ID = ufbg.USING_FORM_BACK_ID\n" |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID\n" |
| | | + "where 1=1 "); |
| | | StringBuilder sql = new StringBuilder("SELECT\n" + "\tDISTINCT ufb.ID,\n" + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufb.DEPARTMENT_NAME,\n" + "\tufb.OPERATOR_NAME,\n" + "\tufb.DEAL_TIME\n" + "FROM\n" |
| | | + "\tusing_form_back ufb\n" + "\tLEFT JOIN using_form_back_goods ufbg ON ufb.ID = ufbg.USING_FORM_BACK_ID\n" |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID\n" + "where 1=1 "); |
| | | |
| | | String businessFormCode = usingFormBackParam.getBusinessFormCode(); |
| | | Long departmentId = usingFormBackParam.getDepartmentId(); |
| | |
| | | map.put("createName", createName); |
| | | } |
| | | sql.append("ORDER BY ufb.CREATE_TIME DESC "); |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), map, usingFormBackParam.getPageNum(), |
| | | usingFormBackParam.getPageSize(), new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), map, |
| | | usingFormBackParam.getPageNum(), usingFormBackParam.getPageSize(), new MapperUtil()); |
| | | PageUtil pageUtil = new PageUtil(mapGenericPager); |
| | | List<UsingFormBackVO> pageList = Lists.newArrayList(); |
| | | mapGenericPager.getDatas().forEach(item -> { |
| | | UsingFormBackVO usingFormBackVO = MapUtils.convertMapToObj(item, UsingFormBackVO.class); |
| | | |
| | | Long id = usingFormBackVO.getId(); |
| | | StringBuilder countSql = new StringBuilder("SELECT \n" |
| | | + "\tufbg.BASE_GOODS_TEMPLATE_NAME,\n" |
| | | + "\tsum(ufbm.COUNTS) count,\n" |
| | | + "\tufbm.UNIT\n" |
| | | + "FROM\n" |
| | | + "\tusing_form_back_goods ufbg\n" |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID\n" |
| | | + "where ufbg.USING_FORM_BACK_ID = :id group by ufbg.BASE_GOODS_TEMPLATE_ID "); |
| | | Map<String, Object> countSqlMap = new HashMap<>(); |
| | | countSqlMap.put("id", id); |
| | | List<Map<String, Object>> select = this.select(countSql.toString(), countSqlMap, new MapperUtil()); |
| | | List<BaseGoodsTemplateInfo> baseGoodsTemplateInfoList = Lists.newArrayList(); |
| | | select.forEach(entity -> { |
| | | BaseGoodsTemplateInfo baseGoodsTemplateInfo = MapUtils.convertMapToObj(entity, BaseGoodsTemplateInfo.class); |
| | | baseGoodsTemplateInfoList.add(baseGoodsTemplateInfo); |
| | | }); |
| | | usingFormBackVO.setGoodsTemplateInfoList(baseGoodsTemplateInfoList); |
| | | List<GoodsTemplateCountVO> usingCount = UsingFormBackModelService.getUsingCountByBusinessId(id); |
| | | usingFormBackVO.setGoodsTemplateInfoList(usingCount); |
| | | pageList.add(usingFormBackVO); |
| | | }); |
| | | pageUtil.setDatas(pageList); |
| | |
| | | |
| | | @Override |
| | | public UsingFormBackDetailVO getDetail(Long id) { |
| | | StringBuilder sql = new StringBuilder("SELECT\n" |
| | | + "\tDISTINCT ufb.ID,\n" |
| | | + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufb.AGENCY_NAME,\n" |
| | | + "\tufb.DEPARTMENT_NAME,\n" |
| | | + "\tufb.OPERATOR_NAME,\n" |
| | | + "\tufb.DEAL_TIME,\n" |
| | | + "\tufb.PROCURE_DOC,\n" |
| | | + "\tufbg.CATEGORY_NAME,\n" |
| | | + "\tufbg.BASE_GOODS_TEMPLATE_NAME,\n" |
| | | + "\tufbg.CLASSIFICATION,\n" |
| | | + "\tufbg.BUSINESS_FORM_CODE,\n" |
| | | + "\tufbm.BASE_GOODS_MODELS_NAME,\n" |
| | | + "\tufbm.BASE_GOODS_TEMPLATE_ID,\n" |
| | | + "\tufbm.BASE_GOODS_MODELS_ID,\n" |
| | | + "\tufbm.UNIT,\n" |
| | | + "\tufbm.COUNTS,\n" |
| | | + "\tufbm.USE_COUNT,\n" |
| | | + "\tufbm.GOODS_USER_NAME\n" |
| | | + "FROM\n" |
| | | + "\tusing_form_back ufb\n" |
| | | + "\tLEFT JOIN using_form_back_goods ufbg ON ufb.ID = ufbg.USING_FORM_BACK_ID\n" |
| | | StringBuilder sql = new StringBuilder("SELECT\n" + "\tDISTINCT ufb.ID,\n" + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufb.AGENCY_NAME,\n" + "\tufb.DEPARTMENT_NAME,\n" + "\tufb.OPERATOR_NAME,\n" + "\tufb.DEAL_TIME,\n" |
| | | + "\tufb.PROCURE_DOC,\n" + "\tufbg.CATEGORY_NAME,\n" + "\tufbg.BASE_GOODS_TEMPLATE_NAME,\n" |
| | | + "\tufbg.CLASSIFICATION,\n" + "\tufbg.BUSINESS_FORM_CODE,\n" + "\tufbm.BASE_GOODS_MODELS_NAME,\n" |
| | | + "\tufbm.BASE_GOODS_TEMPLATE_ID,\n" + "\tufbm.BASE_GOODS_MODELS_ID,\n" + "\tufbm.UNIT,\n" |
| | | + "\tufbm.COUNTS,\n" + "\tufbm.USE_COUNT,\n" + "\tufbm.GOODS_USER_NAME\n" + "FROM\n" |
| | | + "\tusing_form_back ufb\n" + "\tLEFT JOIN using_form_back_goods ufbg ON ufb.ID = ufbg.USING_FORM_BACK_ID\n" |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID where ufb.id =:id"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", id); |
| | |
| | | } |
| | | List<UsingFormBackDetailDTO> usingFormBackDetailDTOList = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | UsingFormBackDetailDTO usingFormBackDetailDTO = MapUtils.convertMapToObj(item, UsingFormBackDetailDTO.class); |
| | | UsingFormBackDetailDTO usingFormBackDetailDTO = |
| | | MapUtils.convertMapToObj(item, UsingFormBackDetailDTO.class); |
| | | usingFormBackDetailDTOList.add(usingFormBackDetailDTO); |
| | | }); |
| | | |
| | | UsingFormBackDetailVO usingFormBackDetailVO = new UsingFormBackDetailVO(); |
| | | List<UsingFormBackGoodsTemplateInfo> goodsTemplateInfoList = Lists.newArrayList(); |
| | | usingFormBackDetailDTOList.stream().collect(Collectors.groupingBy(UsingFormBackDetailDTO::getBaseGoodsTemplateId)) |
| | | usingFormBackDetailDTOList.stream() |
| | | .collect(Collectors.groupingBy(UsingFormBackDetailDTO::getBaseGoodsTemplateId)) |
| | | .forEach((templateId, templateInfo) -> { |
| | | UsingFormBackDetailDTO templateInfoDTO = templateInfo.get(0); |
| | | BeanUtils.copyProperties(templateInfoDTO, usingFormBackDetailVO); |
| | |
| | | goodsTemplateInfoList.add(usingFormBackGoodsTemplateInfo); |
| | | usingFormBackDetailVO.setGoodsTemplateInfoList(goodsTemplateInfoList); |
| | | List<UsingFormBackModelInfo> modelInfoList = Lists.newArrayList(); |
| | | templateInfo.stream().collect(Collectors.groupingBy(UsingFormBackDetailDTO::getBaseGoodsModelsId)).forEach((modelId, modelInfo) -> { |
| | | UsingFormBackDetailDTO modelInfoDTO = modelInfo.get(0); |
| | | UsingFormBackModelInfo usingFormBackModelInfo = new UsingFormBackModelInfo(); |
| | | usingFormBackModelInfo.setBaseGoodsModelsName(modelInfoDTO.getBaseGoodsModelsName()); |
| | | usingFormBackModelInfo.setUnit(modelInfoDTO.getUnit()); |
| | | usingFormBackModelInfo.setId(modelId); |
| | | modelInfoList.add(usingFormBackModelInfo); |
| | | usingFormBackGoodsTemplateInfo.setModelInfoList(modelInfoList); |
| | | List<UseInfo> useInfoList = Lists.newArrayList(); |
| | | for (UsingFormBackDetailDTO useInfoDTO : modelInfo) { |
| | | UseInfo useInfo = new UseInfo(); |
| | | useInfo.setUseName(useInfoDTO.getGoodsUserName()); |
| | | useInfo.setReturnNum(useInfoDTO.getCounts()); |
| | | useInfo.setUseUnm(useInfoDTO.getUseCount()); |
| | | useInfoList.add(useInfo); |
| | | usingFormBackModelInfo.setUseInfoList(useInfoList); |
| | | } |
| | | }); |
| | | templateInfo.stream().collect(Collectors.groupingBy(UsingFormBackDetailDTO::getBaseGoodsModelsId)) |
| | | .forEach((modelId, modelInfo) -> { |
| | | UsingFormBackDetailDTO modelInfoDTO = modelInfo.get(0); |
| | | UsingFormBackModelInfo usingFormBackModelInfo = new UsingFormBackModelInfo(); |
| | | usingFormBackModelInfo.setBaseGoodsModelsName(modelInfoDTO.getBaseGoodsModelsName()); |
| | | usingFormBackModelInfo.setUnit(modelInfoDTO.getUnit()); |
| | | usingFormBackModelInfo.setId(modelId); |
| | | modelInfoList.add(usingFormBackModelInfo); |
| | | usingFormBackGoodsTemplateInfo.setModelInfoList(modelInfoList); |
| | | List<UseInfo> useInfoList = Lists.newArrayList(); |
| | | for (UsingFormBackDetailDTO useInfoDTO : modelInfo) { |
| | | UseInfo useInfo = new UseInfo(); |
| | | useInfo.setUseName(useInfoDTO.getGoodsUserName()); |
| | | useInfo.setReturnNum(useInfoDTO.getCounts()); |
| | | useInfo.setUseUnm(useInfoDTO.getUseCount()); |
| | | useInfoList.add(useInfo); |
| | | usingFormBackModelInfo.setUseInfoList(useInfoList); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | return usingFormBackDetailVO; |
| | |
| | | |
| | | @Override |
| | | public PageUtil selectPageByDetail(UsingFormBackQry usingFormBackParam) { |
| | | StringBuilder sql = new StringBuilder("SELECT\n" |
| | | + "\tufb.ID,\n" |
| | | + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufbm.BASE_GOODS_TEMPLATE_NAME,\n" |
| | | + "\tufbm.BASE_GOODS_MODELS_NAME,\n" |
| | | + "\tufbm.counts,\n" |
| | | + "\tufb.AGENCY_NAME,\n" |
| | | + "\tufb.DEPARTMENT_NAME,\n" |
| | | + "\tufb.OPERATOR_NAME,\n" |
| | | + "\tufb.DEAL_TIME\n" |
| | | + "FROM\n" |
| | | + "\tusing_form_back ufb\n" |
| | | StringBuilder sql = new StringBuilder("SELECT\n" + "\tufb.ID,\n" + "\tufb.BUSINESS_FORM_CODE,\n" |
| | | + "\tufbm.BASE_GOODS_TEMPLATE_NAME,\n" + "\tufbm.BASE_GOODS_MODELS_NAME,\n" + "\tufbm.counts,\n" |
| | | + "\tufb.AGENCY_NAME,\n" + "\tufb.DEPARTMENT_NAME,\n" + "\tufb.OPERATOR_NAME,\n" + "\tufb.DEAL_TIME\n" |
| | | + "FROM\n" + "\tusing_form_back ufb\n" |
| | | + "\tLEFT JOIN using_form_back_goods ufbg ON ufb.ID = ufbg.USING_FORM_BACK_ID\n" |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID\n" |
| | | + "where 1=1 "); |
| | | + "\tLEFT JOIN using_form_back_model ufbm ON ufbg.ID = ufbm.USING_FORM_BACK_GOODS_ID\n" + "where 1=1 "); |
| | | |
| | | String businessFormCode = usingFormBackParam.getBusinessFormCode(); |
| | | Long departmentId = usingFormBackParam.getDepartmentId(); |
| | |
| | | map.put("createName", createName); |
| | | } |
| | | sql.append("ORDER BY ufb.CREATE_TIME DESC "); |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), map, usingFormBackParam.getPageNum(), |
| | | usingFormBackParam.getPageSize(), new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = this.selectSplit(sql.toString(), map, |
| | | usingFormBackParam.getPageNum(), usingFormBackParam.getPageSize(), new MapperUtil()); |
| | | PageUtil pageUtil = new PageUtil(mapGenericPager); |
| | | List<UsingFormBackDetailListVO> pageList = Lists.newArrayList(); |
| | | mapGenericPager.getDatas().forEach(item -> { |
| | |
| | | return pageUtil; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public Long addUsingFormBack(FinSysTenantUser sysInfo, Long departmentId, String departmentName, Long operatorId, String operatorName, Long backTime, |
| | | String procureDoc) { |
| | | public Long addUsingFormBack(FinSysTenantUser sysInfo, Long departmentId, String departmentName, Long operatorId, |
| | | String operatorName, Long backTime, String procureDoc) { |
| | | UsingFormBack usingFormBack = new UsingFormBack(); |
| | | usingFormBack.setId(IdUtil.generateId()); |
| | | usingFormBack.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.GOBACK)); |