17 files modified
1 files added
| | |
| | | secureRegistry.excludePathPatterns("/swagger-resources/**"); |
| | | secureRegistry.excludePathPatterns("/druid/**"); |
| | | secureRegistry.excludePathPatterns("/farmPlant/**"); |
| | | secureRegistry.excludePathPatterns("/land/land/**"); |
| | | secureRegistry.excludePathPatterns("/farmPlant/**"); |
| | | secureRegistry.excludePathPatterns("/soldr/soldr/**"); |
| | | secureRegistry.excludePathPatterns("/stockrecord/stockrecord/**"); |
| | |
| | | import javax.validation.Valid; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 农场养殖记录表控制器 |
| | |
| | | return R.data(map); |
| | | } |
| | | |
| | | /** |
| | | * 小程序农产品种养统计(累计和) |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmPlantStatisticsCountx") |
| | | public R getFarmPlantStatisticsCountx(FarmPlantVO farmPlant, Query query) { |
| | | Double num = 0.0; |
| | | IPage<FarmPlantVO> pages = farmplantService.getFarmPlantStatisticsCountz(Condition.getPage(query), farmPlant); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | String area = pages.getRecords().get(i).getArea(); |
| | | Double a = Double.parseDouble(area); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(a); |
| | | pages.getRecords().get(i).setArea(format); |
| | | num += a; |
| | | } |
| | | Map map = new HashMap(); |
| | | List list = new ArrayList(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(num); |
| | | map.put("znum", format); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 农产品库存控制器 |
| | | * @since 2022-05-18 |
| | | * |
| | | * @author zhongrj |
| | | * @since 2022-05-18 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | |
| | | /** |
| | | * 统计产量 |
| | | * |
| | | * @param farmProductStock |
| | | * @return |
| | | */ |
| | |
| | | * 大屏产量统计 |
| | | */ |
| | | @PostMapping("/selctProductCount") |
| | | public R selctProductCount( String year) { |
| | | public R selctProductCount(String year) { |
| | | return R.data(farmProductStockService.selctProductCount(year)); |
| | | } |
| | | |
| | | /** |
| | | * 小程序统计产量详情 |
| | | * |
| | | * @param farmProductStock |
| | | * @return |
| | | */ |
| | | @GetMapping("/statisticsProductx") |
| | | public R statisticsProductx(FarmProductStockVO farmProductStock, Query query) { |
| | | Double zwei = 0.0; |
| | | IPage<FarmProductStockVO> pages = farmProductStockService.statisticsProductx(Condition.getPage(query), farmProductStock); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | String weight = pages.getRecords().get(i).getWeight(); |
| | | Double a=Double.parseDouble(weight); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(a); |
| | | //产量 |
| | | Double wei = Double.parseDouble(format); |
| | | pages.getRecords().get(i).setWeight(format); |
| | | zwei += wei; |
| | | } |
| | | Map map = new HashMap(); |
| | | List list = new ArrayList(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(zwei); |
| | | map.put("zwei", format); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<FarmPlantVO> selectFarmPlantPage(@Param("page") IPage page, @Param("farmPlant") FarmPlantVO farm); |
| | | List<FarmPlantVO> getFarmPlantStatisticsCountz(@Param("page") IPage page, @Param("farmPlant") FarmPlantVO farm); |
| | | |
| | | /** |
| | | * @param page |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <!--小程序查询农场养殖记录数据--> |
| | | <select id="getFarmPlantStatisticsCountz" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO"> |
| | | SELECT |
| | | sfp.strain_id, |
| | | ss.strain_name strainName, |
| | | sum( sl.land_area ) area, |
| | | land_unit landUnit |
| | | FROM |
| | | sys_farm_plant sfp |
| | | LEFT JOIN sys_strain ss ON ss.id = sfp.strain_id |
| | | LEFT JOIN sys_land sl ON sl.id = sfp.land_id where 1=1 |
| | | <if test="farmPlant.startTime!=null and farmPlant.startTime!=''"> |
| | | and sfp.transplan_time >= #{farmPlant.startTime} |
| | | </if> |
| | | <if test="farmPlant.endTime!=null and farmPlant.endTime!=''"> |
| | | and sfp.transplan_time <= #{farmPlant.endTime} |
| | | </if> |
| | | <if test="farmPlant.deptId!=null and farmPlant.deptId!=''"> |
| | | and sfp.dept_id = #{farmPlant.deptId} |
| | | </if> |
| | | <if test="farmPlant.tenantId!=null and farmPlant.tenantId!=''"> |
| | | and sfp.tenant_id = #{farmPlant.tenantId} |
| | | </if> |
| | | group by sfp.strain_id,strain_name,land_unit |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<FarmProductStockVO> statisticsProduct(@Param("farmProductStock") FarmProductStockVO farmProductStock); |
| | | List<FarmProductStockVO> statisticsProductx(@Param("page") IPage page, @Param("farmProductStock") FarmProductStockVO farmProductStock); |
| | | Map<String, String> selctProductCount(String year); |
| | | } |
| | |
| | | WHERE |
| | | YEAR ( s.time ) =#{year} |
| | | </select> |
| | | |
| | | <!--小程序农产品库存详情数据--> |
| | | <select id="statisticsProductx" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO"> |
| | | select sfps.strain_id strainId,sfps.weight,ss.url,ss.strain_name strainName from |
| | | sys_farm_product_stock sfps |
| | | left join sys_strain ss on ss.id = sfps.strain_id |
| | | where 1=1 |
| | | <if test="farmProductStock.strainId!=null and farmProductStock.strainId!=''"> |
| | | and sfps.strain_id = #{farmProductStock.strainId} |
| | | </if> |
| | | <if test="farmProductStock.leaves!=null and farmProductStock.leaves!=''"> |
| | | and sfps.leaves = #{farmProductStock.leaves} |
| | | </if> |
| | | <if test="farmProductStock.startTime!=null and farmProductStock.startTime!=''"> |
| | | and sfps.time >= #{farmProductStock.startTime} |
| | | </if> |
| | | <if test="farmProductStock.endTime!=null and farmProductStock.endTime!=''"> |
| | | and sfps.time <= #{farmProductStock.endTime} |
| | | </if> |
| | | <if test="farmProductStock.deptId!=null and farmProductStock.deptId!=''"> |
| | | and sfps.dept_id = #{farmProductStock.deptId} |
| | | </if> |
| | | <if test="farmProductStock.tenantId!=null and farmProductStock.tenantId!=''"> |
| | | and sfps.tenant_id = #{farmProductStock.tenantId} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | IPage<FarmPlantVO> selectFarmPlantPage(IPage<FarmPlantVO> page, FarmPlantVO farm); |
| | | IPage<FarmPlantVO> getFarmPlantStatisticsCountz(IPage<FarmPlantVO> page, FarmPlantVO farm); |
| | | |
| | | /** |
| | | * 农产品种养统计 |
| | |
| | | * @return |
| | | */ |
| | | FarmProductStockVO statisticsProduct(FarmProductStockVO farmProductStock); |
| | | IPage<FarmProductStockVO> statisticsProductx(IPage<FarmProductStockVO> page, FarmProductStockVO farmProductStock); |
| | | Map<String, String> selctProductCount(String year); |
| | | } |
| | |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.selectFarmPlantPage(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | if (farmPlantVO.getLandUnit().equals("0")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 1)); |
| | | } |
| | | if (farmPlantVO.getLandUnit().equals("1")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.1)); |
| | | } |
| | | if (farmPlantVO.getLandUnit().equals("2")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.0015)); |
| | | } |
| | | }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FarmPlantVO> getFarmPlantStatisticsCountz(IPage<FarmPlantVO> page, FarmPlantVO farm) { |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatisticsCountz(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | if (farmPlantVO.getLandUnit().equals("1")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.1)); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FarmProductStockVO> statisticsProductx(IPage<FarmProductStockVO> page, FarmProductStockVO farmProductStock) { |
| | | return page.setRecords(baseMapper.statisticsProductx(page, farmProductStock)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Map<String, String> selctProductCount(String year) { |
| | | return baseMapper.selctProductCount(year); |
| | | } |
| | |
| | | <select id="selectZAre" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit |
| | | FROM sys_land |
| | | WHERE is_deleted = 0 and dept_id=#{deprId} |
| | | WHERE is_deleted = 0 |
| | | <if test="deptId!= null and deptId!=''"> |
| | | and dept_id=#{deptId} |
| | | </if> |
| | | </select> |
| | | <!--土地使用面积--> |
| | | <select id="selectSAre" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit |
| | | FROM sys_land |
| | | WHERE is_deleted = 0 |
| | | and type = 0 and dept_id=#{deprId} |
| | | and type = 0 |
| | | <if test="deptId!= null and deptId!=''"> |
| | | and dept_id=#{deptId} |
| | | </if> |
| | | </select> |
| | | <!--土地未使用面积--> |
| | | <select id="selectWAre" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit |
| | | FROM sys_land |
| | | WHERE is_deleted = 0 |
| | | and type = 1 and dept_id=#{deprId} |
| | | and type = 1 |
| | | <if test="deptId!= null and deptId!=''"> |
| | | and dept_id=#{deptId} |
| | | </if> |
| | | </select> |
| | | <select id="selectNum" resultType="java.util.HashMap"> |
| | | SELECT strain_id |
| | | FROM `sys_farm_plant` |
| | | WHERE status = 1 and dept_id=#{deprId} |
| | | WHERE status = 1 |
| | | <if test="deptId!= null and deptId!=''"> |
| | | and dept_id=#{deptId} |
| | | </if> |
| | | GROUP BY strain_id |
| | | </select> |
| | | |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.soldr.vo.SoldrVOs; |
| | | import org.springblade.modules.soldrecord.service.ISoldrecordService; |
| | | import org.springblade.modules.stock.entity.Stock; |
| | | import org.springblade.modules.stock.service.IStockService; |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/outs") |
| | | public R outs(SoldrVOs soldrVOs) { |
| | | //如果等于就修改并删除 |
| | | if (soldrVOs.getType().equals("0")) { |
| | | Stock stock = new Stock(); |
| | | stock.setId(soldrVOs.getId()); |
| | | Stock detail1 = stockService.getOne(Condition.getQueryWrapper(stock)); |
| | | Integer amount = detail1.getAmount(); |
| | | stock.setAmount(amount + soldrVOs.getNum()); |
| | | stockService.Updaet(stock); |
| | | //删除 |
| | | soldrService.del(soldrVOs.getId()); |
| | | } |
| | | //如果小于就修改 |
| | | else { |
| | | Soldr soldr = new Soldr(); |
| | | soldr.setSid(soldrVOs.getId()); |
| | | Soldr detail = soldrService.getOne(Condition.getQueryWrapper(soldr)); |
| | | Integer amount1 = detail.getAmount1(); |
| | | soldrecordService.updateSold(amount1 - soldrVOs.getNum(), soldrVOs.getId()); |
| | | Stock stock = new Stock(); |
| | | stock.setId(soldrVOs.getId()); |
| | | Stock detail1 = stockService.getOne(Condition.getQueryWrapper(stock)); |
| | | Integer amount = detail1.getAmount(); |
| | | stock.setAmount(amount + soldrVOs.getNum()); |
| | | stockService.Updaet(stock); |
| | | } |
| | | return R.success("退回成功"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.soldr.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.soldr.entity.Soldr; |
| | | |
| | | /** |
| | | * 已出库存数量记录表视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class SoldrVOs extends Soldr { |
| | | private static final long serialVersionUID = 1L; |
| | | int num; |
| | | Long id; |
| | | String type; |
| | | |
| | | } |
| | |
| | | <!--查看变更明细--> |
| | | <select id="selectListbg" resultType="org.springblade.modules.soldrecord.vo.SoldrecordVO"> |
| | | SELECT st.stock_id1, |
| | | st.specs1, |
| | | st.amount1, |
| | | stf.factory_name AS factoryName, |
| | | stf.type as stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2, |
| | | b.dict_value AS dic3, |
| | | stf.agricultural_name AS agrname |
| | | st.specs1, |
| | | st.amount1, |
| | | st.create_time, |
| | | f.real_name as username, |
| | | stf.factory_name AS factoryName, |
| | | stf.type as stype, |
| | | d.dict_value AS dic1, |
| | | c.dict_value AS dic2, |
| | | b.dict_value AS dic3, |
| | | stf.agricultural_name AS agrname |
| | | FROM sys_soldrecord st |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs1' AND is_deleted = 0) d ON d.dict_key = st.specs_val1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_val2 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockPurchase1' AND is_deleted = 0) b ON b.dict_key = st.type |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs1' AND is_deleted = 0 <if test="soldrecord.codes!=null and soldrecord.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{soldrecord.codes} |
| | | </if>) d ON d.dict_key = st.specs_val1 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0 <if test="soldrecord.codes!=null and soldrecord.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{soldrecord.codes} |
| | | </if>) c ON c.dict_key = st.specs_val2 |
| | | LEFT JOIN (SELECT dict_key, dict_value |
| | | FROM blade_dict_biz |
| | | WHERE CODE = 'stockPurchase1' AND is_deleted = 0 <if test="soldrecord.codes!=null and soldrecord.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{soldrecord.codes} |
| | | </if>) b ON b.dict_key = st.type |
| | | LEFT JOIN ( SELECT id, real_name FROM blade_user ) f ON f.id=st.create_user |
| | | WHERE st.is_deleted = 0 |
| | | <if test="soldrecord.stockId1!=null and soldrecord.stockId1 != ''"> |
| | | and st.stock_id1 = #{soldrecord.stockId1} |
| | |
| | | </select> |
| | | |
| | | <update id="updateSold"> |
| | | update sys_soldr set amount1=#{amount} where sid = #{id} |
| | | update sys_soldr |
| | | set amount1=#{amount} |
| | | where sid = #{id} |
| | | </update> |
| | | |
| | | <delete id="delc"> |
| | | delete from sys_soldrecord where stock_id1 = #{id} |
| | | delete |
| | | from sys_soldrecord |
| | | where stock_id1 = #{id} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | String spn; |
| | | String agrname; |
| | | Integer cnum; |
| | | String codes; |
| | | } |
| | |
| | | rknu += rknum; |
| | | cknu += cknum; |
| | | } |
| | | Map map= new HashMap(); |
| | | Map map = new HashMap(); |
| | | DecimalFormat df = new DecimalFormat("#0.000"); |
| | | String format = df.format(rknu); |
| | | Double a = Double.parseDouble(format); |
| | | String format1 = df.format(cknu); |
| | | double b = Double.parseDouble(format1); |
| | | map.put("rknum",a); |
| | | map.put("cknum",b); |
| | | map.put("rknum", a); |
| | | map.put("cknum", b); |
| | | return R.data(map); |
| | | } |
| | | |
| | | /** |
| | | * 小程序农资数据统计详情 |
| | | * |
| | | * @param stock |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/pagenums") |
| | | public R pagenums(StocksVO stock, Query query) { |
| | | Double rknu = 0.0; |
| | | Double cknu = 0.0; |
| | | IPage<StocksVO> pages = stockService.slectNum(Condition.getPage(query), stock); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | Double cgnum = pages.getRecords().get(i).getCgnum(); |
| | | Double dbrknum = pages.getRecords().get(i).getDbrknum(); |
| | | double v = cgnum + dbrknum; |
| | | pages.getRecords().get(i).setRknum(v); |
| | | Double lycknum = pages.getRecords().get(i).getLycknum(); |
| | | Double dbcknum = pages.getRecords().get(i).getDbcknum(); |
| | | Double bfcknum = pages.getRecords().get(i).getBfcknum(); |
| | | double v1 = lycknum + dbcknum + bfcknum; |
| | | pages.getRecords().get(i).setCknum(v1); |
| | | } |
| | | for (int j = 0; j < pages.getRecords().size(); j++) { |
| | | Double rknum = pages.getRecords().get(j).getRknum(); |
| | | Double cknum = pages.getRecords().get(j).getCknum(); |
| | | rknu += rknum; |
| | | cknu += cknum; |
| | | } |
| | | Map map = new HashMap(); |
| | | DecimalFormat df = new DecimalFormat("#0.000"); |
| | | String format = df.format(rknu); |
| | | Double a = Double.parseDouble(format); |
| | | String format1 = df.format(cknu); |
| | | double b = Double.parseDouble(format1); |
| | | map.put("rknum", a); |
| | | map.put("cknum", b); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | /** |
| | | * 总的入库数量 |
| | | */ |
| | | Double zrknum; |
| | | /** |
| | | * 总的出库数量 |
| | | */ |
| | | Double zcknum; |
| | | |
| | | } |