1 文件已重命名
2个文件已添加
16个文件已修改
| | |
| | | package com.consum.base; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import com.iplatform.base.util.UserUtils; |
| | | import com.iplatform.core.BeanContextAware; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.file.FileInfo; |
| | | |
| | | public abstract class BaseController extends PlatformAdapterController { |
| | | |
| | |
| | | return this.getFinSysTenantUserCache().get(String.valueOf(userInfo.getId())); |
| | | } |
| | | |
| | | protected void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | OutputStream out = response.getOutputStream(); |
| | | protected String downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws Exception { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", |
| | |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | workbook.write(byteArrayOutputStream); |
| | | response.setHeader("Content-Length", String.valueOf(byteArrayOutputStream.size())); |
| | | out.write(byteArrayOutputStream.toByteArray()); |
| | | |
| | | InputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); |
| | | FileInfo fileInfo = this.uploadFileToLocal(byteArrayInputStream, fileName + ".xls", "-1", |
| | | byteArrayOutputStream.size(), 0, "-1"); |
| | | String fileUrl = fileInfo.getUrl(); |
| | | workbook.close(); |
| | | out.close(); |
| | | return fileUrl; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.consum.base.cache; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.FinSysTenantCacheProvider; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.walker.cache.AbstractCacheProvider; |
| | | import com.walker.cache.Cache; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 区划缓存 |
| | |
| | | return FinSysTenant.class; |
| | | } |
| | | |
| | | public void setFinSysTenantService(FinSysTenantServiceImpl finSysTenantService) { |
| | | public void setFinSysTenantService(FinSysTenantService finSysTenantService) { |
| | | this.finSysTenantService = finSysTenantService; |
| | | } |
| | | |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | } |
| | |
| | | package com.consum.base.cache; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.FinSysTenantCacheProvider; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.walker.infrastructure.ApplicationRuntimeException; |
| | | import com.walker.infrastructure.utils.JsonUtils; |
| | | import com.walker.support.redis.cache.RedisCacheProvider; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 区划缓存 |
| | | * @作者:power |
| | | * @时间:2023/7/20 20:35 |
| | | * |
| | | * @作者:power @时间:2023/7/20 20:35 |
| | | */ |
| | | public class RedisFinSysTenantCache extends RedisCacheProvider<FinSysTenant> implements FinSysTenantCacheProvider { |
| | | public RedisFinSysTenantCache(){ |
| | | public RedisFinSysTenantCache() { |
| | | this.setUseRedis(true); |
| | | this.setLoadPage(false); |
| | | } |
| | | |
| | | @Override |
| | | public FinSysTenant get(String code) { |
| | | FinSysTenant finSysTenant = this.getCacheData(code); |
| | | if(finSysTenant == null){ |
| | | if (finSysTenant == null) { |
| | | finSysTenant = this.finSysTenantService.queryOneByCode(code); |
| | | if(finSysTenant == null){ |
| | | if (finSysTenant == null) { |
| | | logger.warn("从数据库未查询到区划,无法缓存,code = {}", code); |
| | | return null; |
| | | } |
| | | |
| | | // 2023-07-26,时克英,区划相对固定,无需设置失效时间,让他永远存储吧。 |
| | | // this.putCacheData(code, finSysTenant,7200); |
| | | // this.putCacheData(code, finSysTenant,7200); |
| | | this.putCacheData(code, finSysTenant); |
| | | } |
| | | return finSysTenant; |
| | |
| | | @Override |
| | | public FinSysTenant getById(String id) { |
| | | FinSysTenant finSysTenant = this.getCacheData(id); |
| | | if(finSysTenant == null){ |
| | | if (finSysTenant == null) { |
| | | finSysTenant = this.finSysTenantService.get(new FinSysTenant(Long.parseLong(id))); |
| | | if(finSysTenant == null){ |
| | | if (finSysTenant == null) { |
| | | logger.warn("从数据库未查询到区划,无法缓存,id = {}", id); |
| | | return null; |
| | | } |
| | |
| | | public List<FinSysTenant> selectAll() { |
| | | List<FinSysTenant> allTree = new ArrayList<>(); |
| | | FinSysTenant temp = null; |
| | | for(String value : this.getCache().getIterator(null)) { |
| | | for (String value : this.getCache().getIterator(null)) { |
| | | try { |
| | | temp = JsonUtils.jsonStringToObject(value, FinSysTenant.class); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationRuntimeException("redis存储'EbProductBrand'解析错吴:"+ value,ex); |
| | | throw new ApplicationRuntimeException("redis存储'EbProductBrand'解析错吴:" + value, ex); |
| | | } |
| | | allTree.add(temp); |
| | | } |
| | |
| | | return FinSysTenant.class; |
| | | } |
| | | |
| | | public void setFinSysTenantService(FinSysTenantServiceImpl finSysTenantService) { |
| | | public void setFinSysTenantService(FinSysTenantService finSysTenantService) { |
| | | this.finSysTenantService = finSysTenantService; |
| | | } |
| | | |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | } |
| | |
| | | package com.consum.base.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import com.consum.base.FinOrgCacheProvider; |
| | | import com.consum.base.FinSysTenantCacheProvider; |
| | | import com.consum.base.FinSysTenantUserCacheProvider; |
| | |
| | | import com.consum.base.cache.LocalFinSysTenantUserCache; |
| | | import com.consum.base.cache.LocalTokenCache; |
| | | import com.consum.base.service.FinOrgService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.FinSysTenantUserServiceImpl; |
| | | import com.iplatform.base.config.CacheConfiguration; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "false", matchIfMissing = true) |
| | |
| | | * @date 2023-07-05 |
| | | */ |
| | | @Bean |
| | | public FinSysTenantCacheProvider finSysTenantCacheProvider(FinSysTenantServiceImpl finSysTenantService){ |
| | | public FinSysTenantCacheProvider finSysTenantCacheProvider(FinSysTenantService finSysTenantService){ |
| | | LocalFinSysTenantCache cache = new LocalFinSysTenantCache(); |
| | | cache.setFinSysTenantService(finSysTenantService); |
| | | return cache; |
| | |
| | | package com.consum.base.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import com.consum.base.FinOrgCacheProvider; |
| | | import com.consum.base.FinSysTenantCacheProvider; |
| | | import com.consum.base.FinSysTenantUserCacheProvider; |
| | |
| | | import com.consum.base.cache.RedisFinSysTenantUserCache; |
| | | import com.consum.base.cache.RedisTokenCache; |
| | | import com.consum.base.service.FinOrgService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.FinSysTenantUserServiceImpl; |
| | | import com.iplatform.base.config.CacheConfiguration; |
| | | import com.walker.support.redis.RedisHelper; |
| | | import com.walker.support.redis.cache.RedisCacheProvider; |
| | | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) |
| | |
| | | * @date 2023-07-05 |
| | | */ |
| | | @Bean |
| | | public FinSysTenantCacheProvider finSysTenantCacheProvider(RedisHelper redisHelper, FinSysTenantServiceImpl finSysTenantService){ |
| | | public FinSysTenantCacheProvider finSysTenantCacheProvider(RedisHelper redisHelper, FinSysTenantService finSysTenantService){ |
| | | RedisFinSysTenantCache cache = new RedisFinSysTenantCache(); |
| | | cache.setRedisHelper(redisHelper); |
| | | cache.setFinSysTenantService(finSysTenantService); |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | 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.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.pojo.BaseGoodsTemplateParam; |
| | | import com.consum.base.pojo.excel.ImportGoodsInfoTemplate; |
| | | import com.consum.base.pojo.response.GoodsTemplateVO; |
| | | import com.consum.base.service.BaseGoodsTemplateService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.SDictData; |
| | | import com.consum.model.vo.BaseGoodsTemplateVo; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.web.ResponseValue; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | |
| | | @Autowired |
| | | private FinSysTenantService finSysTenantService; |
| | | |
| | | /** |
| | | * @Description 新增物品模板 |
| | |
| | | return ResponseValue.success("查询成功!", resultList); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | public ResponseValue upload(MultipartFile file) throws IOException { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (!originalFilename.endsWith(".xls")) { |
| | | return ResponseValue.error("文件格式有误!"); |
| | | } |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("当前登录用户为空"); |
| | | } |
| | | EasyExcel.read(file.getInputStream(), ImportGoodsInfoTemplate.class, |
| | | new AnalysisEventListener<ImportGoodsInfoTemplate>() { |
| | | List<BaseGoodsTemplateParam> list = Lists.newArrayList(); |
| | | |
| | | @Override |
| | | public void invoke(ImportGoodsInfoTemplate data, AnalysisContext analysisContext) { |
| | | String categoryOne = data.getCategoryOne(); |
| | | String categoryTwo = data.getCategoryTwo(); |
| | | String categoryThree = data.getCategoryThree(); |
| | | String goodName = data.getGoodName(); |
| | | String goodModel = data.getGoodModel(); |
| | | String unit = data.getUnit(); |
| | | String type = data.getType(); |
| | | String agencyName = data.getAgencyName(); |
| | | |
| | | list.stream().forEach(item -> { |
| | | if (!item.getCategoryId().equals(categoryThree)) { |
| | | BaseGoodsTemplateParam baseGoodsTemplate = new BaseGoodsTemplateParam(); |
| | | baseGoodsTemplate.setCategoryId(Long.valueOf(categoryThree)); |
| | | baseGoodsTemplate.setGoodsName(goodName); |
| | | baseGoodsTemplate.setStates(1); |
| | | FinSysTenant finSysTenant = finSysTenantService.selectByName(agencyName); |
| | | baseGoodsTemplate.setAgencyId(finSysTenant.getId()); |
| | | |
| | | List<BaseGoodsModels> models = Lists.newArrayList(); |
| | | BaseGoodsModels baseGoodsModels = new BaseGoodsModels(); |
| | | baseGoodsModels.setModelName(goodModel); |
| | | baseGoodsModels.setStates(1); |
| | | baseGoodsModels.setGoodsTemplatesId(item.getId()); |
| | | baseGoodsModels.setUnit(unit); |
| | | baseGoodsModels.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | models.add(baseGoodsModels); |
| | | baseGoodsTemplate.setModels(models); |
| | | } else { |
| | | List<BaseGoodsModels> models = item.getModels(); |
| | | BaseGoodsModels baseGoodsModels = new BaseGoodsModels(); |
| | | baseGoodsModels.setModelName(goodModel); |
| | | baseGoodsModels.setStates(1); |
| | | baseGoodsModels.setGoodsTemplatesId(item.getId()); |
| | | baseGoodsModels.setUnit(unit); |
| | | baseGoodsModels.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | models.add(baseGoodsModels); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | for (BaseGoodsTemplateParam a : list) { |
| | | baseGoodsTemplateService.add(a, sysInfo); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onException(Exception exception, AnalysisContext analysisContext) throws Exception { |
| | | if (exception instanceof ExcelDataConvertException) { |
| | | ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException)exception; |
| | | Integer row = excelDataConvertException.getRowIndex() + 1; |
| | | Integer column = excelDataConvertException.getColumnIndex() + 1; |
| | | throw new RuntimeException("第" + row + "行,第" + column + "列解析异常,请正确填写"); |
| | | } |
| | | } |
| | | }).sheet(0).doRead(); |
| | | |
| | | return ResponseValue.success("导入成功!", 1); |
| | | } |
| | | } |
| | |
| | | import com.consum.base.core.utils.FinSysTenantUtils; |
| | | import com.consum.base.pojo.FinSysTenantParam; |
| | | import com.consum.base.pojo.FinSysTenantSearchParam; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.FinSysTenantUserServiceImpl; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | |
| | | @RequestMapping("/pc/fin/sys/tenant") |
| | | public class FinSysTenantController extends BaseController { |
| | | |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | |
| | | @Autowired |
| | | private FinSysTenantUserServiceImpl finSysTenantUserService; |
| | | |
| | | @Autowired |
| | | public FinSysTenantController(FinSysTenantServiceImpl finSysTenantService) { |
| | | public FinSysTenantController(FinSysTenantService finSysTenantService) { |
| | | this.finSysTenantService = finSysTenantService; |
| | | } |
| | | |
| | |
| | | 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.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.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | |
| | | import com.consum.base.pojo.response.FinSysTenantVO; |
| | | import com.consum.base.pojo.response.UserVO; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.FinSysTenantUserServiceImpl; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantDepartment; |
| | |
| | | import com.iplatform.model.po.S_role; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.*; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | 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 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.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description 系统用户 |
| | |
| | | |
| | | private UserServiceImpl userService; |
| | | |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | |
| | | private RoleServiceImpl roleService; |
| | | |
| | |
| | | } |
| | | |
| | | @Autowired |
| | | public FinSysTenantUserController(FinSysTenantServiceImpl finSysTenantService, |
| | | public FinSysTenantUserController(FinSysTenantService finSysTenantService, |
| | | FinSysTenantUserServiceImpl finSysTenantUserService, RoleServiceImpl roleService) { |
| | | this.finSysTenantUserService = finSysTenantUserService; |
| | | this.finSysTenantService = finSysTenantService; |
| | |
| | | } |
| | | tenantUser.setUserPhone(encPhone); |
| | | // 怎么获取左侧机构树数据 |
| | | // tenantUser.setSysDeptId(3L); // 对应平台机构id 默认为平台管理 |
| | | // tenantUser.setSysDeptId(3L); // 对应平台机构id 默认为平台管理 |
| | | this.finSysTenantUserService.insert(tenantUser); |
| | | |
| | | // 插入平台用户 |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "盘点单id", dataType = "Long", required = true, paramType = "query")}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | public String export(Long id, HttpServletResponse response) throws Exception { |
| | | |
| | | List<InventoryExcelTemplate> exportList = lWhFormInventoryService.getExportList(id); |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | |
| | | map.put("monitorName", monitorName); |
| | | map.put("name", operatorName); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, InventoryExcelTemplate.class, exportList, map); |
| | | |
| | | downLoadExcel("低值易耗品盘点表", response, workbook); |
| | | return downLoadExcel("低值易耗品盘点表", response, workbook); |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "出库单导出", notes = "出库单导出") |
| | | @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query") |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | public String export(Long id, HttpServletResponse response) throws Exception { |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | if (sysInfo == null) { |
| | | throw new RuntimeException("登录用户信息不存在"); |
| | |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, OutputExcelTemplate.class, exportList, map); |
| | | downLoadExcel("出库单", response, workbook); |
| | | return downLoadExcel("出库单", response, workbook); |
| | | |
| | | } |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "采购单id", required = true, dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | public String export(Long id, HttpServletResponse response) throws Exception { |
| | | TemplateExportParams params = new TemplateExportParams("import/采购入库单.xls"); |
| | | params.setHeadingStartRow(2); |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, ProcureExcelTemplate.class, exportList, map); |
| | | downLoadExcel("采购入库单", response, workbook); |
| | | return downLoadExcel("采购入库单", response, workbook); |
| | | |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "导出报废单", notes = "导出报废单") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")}) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | public String export(Long id, HttpServletResponse response) throws Exception { |
| | | if (id == null) { |
| | | throw new RuntimeException("报废单id为空"); |
| | | } |
| | |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook sheets = ExcelExportUtil.exportExcel(exportParams, ScrappedInfoExcelTemplate.class, export, map); |
| | | downLoadExcel("报废登记单", response, sheets); |
| | | return downLoadExcel("报废登记单", response, sheets); |
| | | |
| | | } |
| | | |
| | |
| | | @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 { |
| | | public String export(Long id, Integer type, HttpServletResponse response) throws Exception { |
| | | |
| | | TemplateExportParams params; |
| | | String fileName; |
| | |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, TransferExcelTemplate.class, export, map); |
| | | downLoadExcel(fileName, response, workbook); |
| | | return downLoadExcel(fileName, response, workbook); |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.consum.base.pojo.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 导入物品信息 |
| | | * @date 2023/12/11 14:25 |
| | | */ |
| | | @Data |
| | | public class ImportGoodsInfoTemplate { |
| | | |
| | | @ExcelProperty("一级分类") |
| | | private String categoryOne; |
| | | @ExcelProperty("二级分类") |
| | | private String categoryTwo; |
| | | @ExcelProperty("三级分类") |
| | | private String categoryThree; |
| | | @ExcelProperty("物品名称") |
| | | private String goodName; |
| | | @ExcelProperty("规格型号") |
| | | private String goodModel; |
| | | @ExcelProperty("单位") |
| | | private String unit; |
| | | @ExcelProperty("采购类型") |
| | | private String type; |
| | | @ExcelProperty("所属机构") |
| | | private String agencyName; |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.consum.base.pojo.FinSysTenantParam; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.walker.jdbc.service.BaseService; |
| | | |
| | | /** |
| | | * FinSysTenantService |
| | | * |
| | | * @author asus |
| | | * @version 2023/12/11 17:14 |
| | | **/ |
| | | public interface FinSysTenantService extends BaseService { |
| | | FinSysTenant queryOneByCode(String code); |
| | | |
| | | List<FinSysTenant> queryForTree(); |
| | | |
| | | List<FinSysTenant> queryTreeById(Long id, Integer lv); |
| | | |
| | | Map<Long, List<FinSysTenant>> queryCountyByCityCode(Long id, Integer lv); |
| | | |
| | | int updateById(FinSysTenantParam param, FinSysTenantUser sysInfo); |
| | | |
| | | int addFinSysTenant(FinSysTenantParam param, FinSysTenantUser sysInfo, int lv); |
| | | |
| | | void setLvIdAndName(FinSysTenantParam param, FinSysTenant finSysTenant, long id, int lv); |
| | | |
| | | void insertFinSysTenantBatch(List<FinSysTenantParam> params, FinSysTenantUser sysInfo, int lv); |
| | | |
| | | int updateFinSysTenant(FinSysTenant finSysTenant, FinSysTenantUser sysInfo); |
| | | |
| | | FinSysTenant selectById(Long id); |
| | | |
| | | FinSysTenant selectByName(String tenantName); |
| | | } |
| | |
| | | import com.consum.base.pojo.BaseWarehouseParam; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantDepartmentService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.SDictDataServiceImpl; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenant; |
| | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | @Autowired |
| | | private FinSysTenantDepartmentService departmentService; |
| | | @Autowired |
File was renamed from consum-base/src/main/java/com/consum/base/service/FinSysTenantServiceImpl.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.stream.Collectors; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.consum.base.pojo.FinSysTenantParam; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | 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 org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class FinSysTenantServiceImpl extends BaseServiceImpl { |
| | | public class FinSysTenantServiceImpl extends BaseServiceImpl implements FinSysTenantService { |
| | | |
| | | private static final String QUERY_TREE_ALL = "select * from FIN_SYS_TENANT where is_delete = 0 and status = 1 order by parent_id, LV ASC"; |
| | | private static final String QUERY_TREE_ALL = |
| | | "select * from FIN_SYS_TENANT where is_delete = 0 and status = 1 order by parent_id, LV ASC"; |
| | | private static final String QUERY_TREE_BY_CODE = "SELECT * FROM FIN_SYS_TENANT "; |
| | | private static final String QUERY_LIST_BY_CITY_CODE = "SELECT ID, NAME, CODE, CASE WHEN LV = 2 THEN ID ELSE PARENT_ID END AS PARENT_ID, LV, TENANT_TYPE, BELONG_PROVINCE FROM FIN_SYS_TENANT "; |
| | | private static final String QUERY_LV2_ALL = "SELECT * FROM FIN_SYS_TENANT WHERE LV < 3 ORDER BY CODE ASC"; |
| | | private static final String QUERY_LIST_BY_CITY_CODE = |
| | | "SELECT ID, NAME, CODE, CASE WHEN LV = 2 THEN ID ELSE PARENT_ID END AS PARENT_ID, LV, TENANT_TYPE, BELONG_PROVINCE FROM FIN_SYS_TENANT "; |
| | | |
| | | /** |
| | | * @Author :power |
| | | * @Date : 2023/7/20 20:41 获取区划信息 主要用于缓存 |
| | | */ |
| | | @Override |
| | | public FinSysTenant queryOneByCode(String code) { |
| | | FinSysTenant tenant = new FinSysTenant(); |
| | | tenant.setCode(code); |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<FinSysTenant> queryForTree() { |
| | | // 展示全部节点 |
| | | return this.select(QUERY_TREE_ALL, new Object[]{}, new FinSysTenant()); |
| | | return this.select(QUERY_TREE_ALL, new Object[] {}, new FinSysTenant()); |
| | | } |
| | | |
| | | /** |
| | | * @Author :power |
| | | * @Date : 2023/7/20 16:34 根据id 查询下级所有节点 地市查询自己 省查询所有地市 |
| | | */ |
| | | @Override |
| | | public List<FinSysTenant> queryTreeById(Long id, Integer lv) { |
| | | if (lv == 3) { |
| | | return new ArrayList<>(); |
| | |
| | | * @Author :power |
| | | * @Date : 2023/7/21 14:46 特殊数据 禁止其他接口使用 |
| | | */ |
| | | @Override |
| | | public Map<Long, List<FinSysTenant>> queryCountyByCityCode(Long id, Integer lv) { |
| | | Map<String, Object> parameter = new HashMap<>(5); |
| | | StringBuilder sql = new StringBuilder(QUERY_LIST_BY_CITY_CODE); |
| | |
| | | } |
| | | sql.append(" ORDER BY PARENT_ID ,ID "); |
| | | List<FinSysTenant> list = this.select(sql.toString(), parameter, new FinSysTenant()); |
| | | // return list.stream().filter(tenant -> Objects.nonNull(tenant.getParentId())).collect(Collectors.groupingBy(FinSysTenant::getParentId)); |
| | | // return list.stream().filter(tenant -> |
| | | // Objects.nonNull(tenant.getParentId())).collect(Collectors.groupingBy(FinSysTenant::getParentId)); |
| | | return list.stream().collect(Collectors.groupingBy(FinSysTenant::getParentId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 查询所有的市级带河南省的区划 |
| | | * @Author wh |
| | | * @Date 2023/7/20 15:29 |
| | | */ |
| | | public List<FinSysTenant> selectByLV2() { |
| | | return this.select(QUERY_LV2_ALL, new Object[]{}, new FinSysTenant()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/4 |
| | | */ |
| | | @Override |
| | | public int updateById(FinSysTenantParam param, FinSysTenantUser sysInfo) { |
| | | FinSysTenant finSysTenant = new FinSysTenant(); |
| | | finSysTenant.setTempId(param.getId()); |
| | |
| | | return this.update(finSysTenant); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加机构 |
| | | * |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/4 |
| | | */ |
| | | @Override |
| | | public int addFinSysTenant(FinSysTenantParam param, FinSysTenantUser sysInfo, int lv) { |
| | | FinSysTenant finSysTenant = new FinSysTenant(); |
| | | |
| | | //id和tempId |
| | | // id和tempId |
| | | StringBuilder sql = new StringBuilder("SELECT max(id) FROM fin_sys_tenant WHERE 1=1"); |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | |
| | |
| | | List<Map<String, Object>> list = this.select(sql.toString(), paramts); |
| | | long id = 0L; |
| | | if (!CollectionUtils.isEmpty(list) && list.get(0).get("max(id)") != null) { |
| | | id = (Long) list.get(0).get("max(id)") + 1; |
| | | id = (Long)list.get(0).get("max(id)") + 1; |
| | | } else { |
| | | id = param.getParentId() * 1000 + 1; |
| | | } |
| | |
| | | |
| | | finSysTenant.setParentId(param.getParentId()); |
| | | finSysTenant.setCode(param.getCode()); |
| | | //设置详细地址及经纬度 |
| | | // 设置详细地址及经纬度 |
| | | finSysTenant.setName(param.getName()); |
| | | finSysTenant.setCreateTime3(DateUtils.getDate("yyyy-MM-dd HH:mm:ss")); |
| | | finSysTenant.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | finSysTenant.setSummary(param.getSummary()); |
| | | finSysTenant.setCreateBy(sysInfo.getUserName()); |
| | | //设置各层级id及名称 |
| | | // 设置各层级id及名称 |
| | | finSysTenant.setLv(lv); |
| | | setLvIdAndName(param, finSysTenant, id, lv); |
| | | |
| | |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/4 |
| | | */ |
| | | private void setLvIdAndName(FinSysTenantParam param, FinSysTenant finSysTenant, long id, int lv) { |
| | | if (lv == 2) { //新增市级机构 |
| | | //查询上一级 - 省级 |
| | | @Override |
| | | public void setLvIdAndName(FinSysTenantParam param, FinSysTenant finSysTenant, long id, int lv) { |
| | | if (lv == 2) { // 新增市级机构 |
| | | // 查询上一级 - 省级 |
| | | FinSysTenant finSysTenant1 = this.get(new FinSysTenant(param.getParentId())); |
| | | if (finSysTenant1 != null) { |
| | | finSysTenant.setLv1Id(finSysTenant1.getId()); |
| | |
| | | finSysTenant.setLv2Id(id); |
| | | finSysTenant.setLv2Name(param.getName()); |
| | | } |
| | | } else if (lv == 3) { //新增县级机构 |
| | | //查询上一级 - 市级 |
| | | } else if (lv == 3) { // 新增县级机构 |
| | | // 查询上一级 - 市级 |
| | | FinSysTenant finSysTenant2 = this.get(new FinSysTenant(param.getParentId())); |
| | | if (finSysTenant2 != null) { |
| | | //查询上一级 - 省级 |
| | | // 查询上一级 - 省级 |
| | | FinSysTenant finSysTenant1 = this.get(new FinSysTenant(finSysTenant2.getParentId())); |
| | | |
| | | finSysTenant.setLv1Id(finSysTenant1.getId()); |
| | |
| | | finSysTenant.setLv3Id(id); |
| | | finSysTenant.setLv3Name(param.getName()); |
| | | } |
| | | } else if (lv == 4) { //新增支局机构 |
| | | //查询上一级 - 县级 |
| | | } else if (lv == 4) { // 新增支局机构 |
| | | // 查询上一级 - 县级 |
| | | FinSysTenant finSysTenant3 = this.get(new FinSysTenant(param.getParentId())); |
| | | if (finSysTenant3 != null) { |
| | | //查询上一级 - 市级 |
| | | // 查询上一级 - 市级 |
| | | FinSysTenant finSysTenant2 = this.get(new FinSysTenant(finSysTenant3.getParentId())); |
| | | if (finSysTenant2 != null) { |
| | | //查询上一级 - 省级 |
| | | // 查询上一级 - 省级 |
| | | FinSysTenant sysTenant1 = this.get(new FinSysTenant(finSysTenant2.getParentId())); |
| | | if (sysTenant1 != null) { |
| | | finSysTenant.setLv1Id(sysTenant1.getId()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量添加机构 |
| | | * |
| | | * @author jlq |
| | | * @date 2023/10/9 |
| | | */ |
| | | @Override |
| | | public void insertFinSysTenantBatch(List<FinSysTenantParam> params, FinSysTenantUser sysInfo, int lv) { |
| | | for (FinSysTenantParam param : params) { |
| | | addFinSysTenant(param, sysInfo, lv); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑 |
| | |
| | | * @author 卢庆阳 |
| | | * @date 2023/10/6 |
| | | */ |
| | | @Override |
| | | public int updateFinSysTenant(FinSysTenant finSysTenant, FinSysTenantUser sysInfo) { |
| | | Integer lv = finSysTenant.getLv(); |
| | | if (lv == 1) { |
| | |
| | | return this.update(finSysTenant); |
| | | } |
| | | |
| | | @Override |
| | | public FinSysTenant selectById(Long id) { |
| | | FinSysTenant tenant = new FinSysTenant(); |
| | | tenant.setTempId(id); |
| | | return this.get(tenant); |
| | | } |
| | | |
| | | @Override |
| | | public FinSysTenant selectByName(String tenantName) { |
| | | FinSysTenant tenant = new FinSysTenant(); |
| | | tenant.setName(tenantName); |
| | | return this.select(tenant).stream().findFirst().orElse(null); |
| | | } |
| | | } |
| | |
| | | import com.consum.base.pojo.response.FormInventoryGoodsVO; |
| | | import com.consum.base.pojo.response.FormInventoryVO; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.LWhFormInventoryGoodsService; |
| | | import com.consum.base.service.LWhFormInventoryService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | @Autowired |
| | | @Lazy |
| | | private LWhFormInventoryCoreService lWhFormInventoryCoreService; |
| | |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.base.service.BaseWarehouseManagerService; |
| | | import com.consum.base.service.BaseWarehouseService; |
| | | import com.consum.base.service.FinSysTenantServiceImpl; |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.base.service.LWhFormTransferService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | |
| | | @Autowired |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Autowired |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | private FinSysTenantService finSysTenantService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |