| | |
| | | secureRegistry.excludePathPatterns("/farmPlant/**"); |
| | | secureRegistry.excludePathPatterns("/task/task/**"); |
| | | secureRegistry.excludePathPatterns("/recovery/**"); |
| | | secureRegistry.excludePathPatterns("/farm/**"); |
| | | secureRegistry.excludePathPatterns("/farmingRecord/**"); |
| | | secureRegistry.excludePathPatterns("/blade-user/**"); |
| | | secureRegistry.excludePathPatterns("/soldrecord/soldrecord/**"); |
| | | secureRegistry.excludePathPatterns("/stockfactory/stockfactory/**"); |
| | |
| | | */ |
| | | @Override |
| | | public void addCorsMappings(CorsRegistry registry) { |
| | | registry.addMapping("/cors/**") |
| | | registry.addMapping("/**") |
| | | .allowedOrigins("*") |
| | | .allowedHeaders("*") |
| | | .allowedMethods("*") |
| | |
| | | import org.springblade.modules.farm.service.FarmService; |
| | | import org.springblade.modules.farm.vo.FarmVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 农场控制器 |
| | | * @since 2022-05-10 |
| | | * |
| | | * @author zhongrj |
| | | * @since 2022-05-10 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | public R update(@Valid @RequestBody Farm farm) { |
| | | farm.setUpdateTime(new Date()); |
| | | //坐标转换 |
| | | if (null!=farm.getPosition() && !farm.getPosition().equals("")) { |
| | | if (null != farm.getPosition() && !farm.getPosition().equals("")) { |
| | | //替换逗号为空格 |
| | | String sNull = farm.getPosition().replaceAll(",", " "); |
| | | //替换分号为逗号 |
| | |
| | | return R.status(farmService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @GetMapping("/SelectCount") |
| | | public R SelectCount() { |
| | | //农场数量 |
| | | Integer integer = farmService.selectCountFarm(); |
| | | //人员数量 |
| | | Integer integer1 = farmService.selectCountUser(); |
| | | Map map = new HashMap<>(); |
| | | map.put("ncnum", integer); |
| | | map.put("rynum", integer1); |
| | | return R.data(map); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springblade.modules.stockfactory.service.IStockfactoryService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 农事记录控制器 |
| | |
| | | //通过已出资农资id查询已出农资详情 |
| | | Soldr soldr = new Soldr(); |
| | | farm.setCreateTime(new Date()); |
| | | if(farm.getStockId()!=""){ |
| | | if (farm.getStockId() != "") { |
| | | Long id = Long.valueOf(farm.getStockId()); |
| | | soldr.setId(id); |
| | | //返回已出农资详情 |
| | |
| | | if (specsValue1 == 5) { |
| | | v = farm.getSnum() * spe; |
| | | } |
| | | Long ids = Long.valueOf(detail.getStockId1()); |
| | | Long ids = Long.valueOf(detail.getStockId1()); |
| | | farm.setStockId(detail.getStockId1()); |
| | | farm.setCensus(v); |
| | | farm.setCreateTime(new Date()); |
| | |
| | | stockfactory.setId(ids); |
| | | Stockfactory detailstock = stockfactoryService.getOne(Condition.getQueryWrapper(stockfactory)); |
| | | String agriculturalName = detailstock.getAgriculturalName(); |
| | | String content=agriculturalName+" "+v+"公斤"; |
| | | String content = agriculturalName + " " + v + "公斤"; |
| | | farm.setContent(content); |
| | | //使用农资数量等于已出农资数量 |
| | | if (farm.getSnum() == detail.getAmount1()) { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmingCount") |
| | | public R getFarmingCount() { |
| | | return R.data(farmService.getFarmingCount()); |
| | | public R getFarmingCount(String deptId) { |
| | | return R.data(farmService.getFarmingCount(deptId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询统计本年农事记录操作,按分类统计 |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmingStatis") |
| | | public R getFarmingStatis() { |
| | | return R.data(farmService.getFarmingStatis()); |
| | | public R getFarmingStatis(String deptId) { |
| | | return R.data(farmService.getFarmingStatis(deptId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 大屏农资使用概况统计 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getStockCount") |
| | | public R getStockCount(String deptId) { |
| | | //今年 |
| | | Double aDouble = farmService.selectJyCount(deptId); |
| | | //去年 |
| | | Double aDouble1 = farmService.selectQyCount(deptId); |
| | | //本月 |
| | | Double aDouble2 = farmService.selectByCount(deptId); |
| | | Map map = new HashMap(); |
| | | map.put("jn", aDouble); |
| | | map.put("qn", aDouble1); |
| | | map.put("by", aDouble2); |
| | | return R.data(map); |
| | | } |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Farm getFarmInfo(@Param("farm") FarmVO farm); |
| | | Integer selectCountFarm(); |
| | | Integer selectCountUser(); |
| | | } |
| | |
| | | |
| | | <!--自定义查询农场分页数据--> |
| | | <select id="selectFarmPage" resultType="org.springblade.modules.farm.vo.FarmVO"> |
| | | select |
| | | id,farm_name,farm_address,farm_area,slogan,introduce,picture,ST_ASTEXT(position) as position,user_id |
| | | select id, |
| | | farm_name, |
| | | farm_address, |
| | | farm_area, |
| | | slogan, |
| | | introduce, |
| | | picture, |
| | | ST_ASTEXT(position) as position,user_id |
| | | from |
| | | sys_farm where 1=1 |
| | | sys_farm |
| | | where 1=1 |
| | | </select> |
| | | |
| | | <!--自定义修改电子围栏数据--> |
| | |
| | | |
| | | <!--详情信息(自定义查询)--> |
| | | <select id="getFarmInfo" resultType="org.springblade.modules.farm.vo.FarmVO"> |
| | | select |
| | | id,farm_name,farm_address,farm_area,slogan,introduce,picture,ST_ASTEXT(position) as position,dept_id |
| | | select id, |
| | | farm_name, |
| | | farm_address, |
| | | farm_area, |
| | | slogan, |
| | | introduce, |
| | | picture, |
| | | ST_ASTEXT(position) as position,dept_id |
| | | from |
| | | sys_farm |
| | | sys_farm |
| | | where 1=1 |
| | | and dept_id = #{farm.deptId} |
| | | and dept_id = #{farm.deptId} |
| | | </select> |
| | | |
| | | <!--农场数量--> |
| | | <select id="selectCountFarm" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) as count |
| | | FROM `blade_dept` |
| | | WHERE tenant_id='000000' AND is_deleted=0 AND parent_id!=0 |
| | | </select> |
| | | |
| | | <!--人员数量--> |
| | | <select id="selectCountUser" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) as countuser |
| | | FROM `blade_user` |
| | | WHERE tenant_id = '000000' |
| | | AND is_deleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * 查询统计本年农事记录操作总数 |
| | | * @return |
| | | */ |
| | | Integer getFarmingCount(); |
| | | Integer getFarmingCount(String deptId); |
| | | |
| | | /** |
| | | * 查询统计本年农事记录操作,按分类统计 |
| | | * @return |
| | | */ |
| | | List<FarmingStatisVO> getFarmingStatis(); |
| | | List<FarmingStatisVO> getFarmingStatis(String deptId); |
| | | //今年农资使用量 |
| | | Double selectJyCount(String deptId); |
| | | //去年农资使用量 |
| | | Double selectQyCount(String deptId); |
| | | //本月农资使用量 |
| | | Double selectByCount(String deptId); |
| | | } |
| | |
| | | |
| | | <!--查询统计本年农事记录操作总数--> |
| | | <select id="getFarmingCount" resultType="java.lang.Integer"> |
| | | select ifnull(count(*),0) count from sys_farming_record |
| | | select ifnull(count(*), 0) count |
| | | from sys_farming_record |
| | | where 1=1 |
| | | and YEAR(time)=YEAR(NOW()) |
| | | and YEAR (time)= YEAR (NOW()) |
| | | and dept_id=#{deptId} |
| | | </select> |
| | | |
| | | <!--查询统计本年农事记录操作总数--> |
| | | <select id="getFarmingStatis" resultType="org.springblade.modules.farm.vo.FarmingStatisVO"> |
| | | select |
| | | case when type=0 then '施肥' |
| | | when type=1 then '翻耕' |
| | | when type=2 then '灌溉' |
| | | when type=3 then '起垄' |
| | | when type=4 then '用药' |
| | | when type=5 then '追肥' |
| | | when type=6 then '除草' |
| | | when type=7 then '修剪' |
| | | when type=8 then '浸种' |
| | | when type=9 then '拌种' |
| | | when type=10 then '移栽' |
| | | when type=11 then '直播' |
| | | when type=12 then '采收' |
| | | else '其他' end as name, |
| | | ifnull(count(*),0) value |
| | | select case |
| | | when type = 0 then '施肥' |
| | | when type = 1 then '翻耕' |
| | | when type = 2 then '灌溉' |
| | | when type = 3 then '起垄' |
| | | when type = 4 then '用药' |
| | | when type = 5 then '追肥' |
| | | when type = 6 then '除草' |
| | | when type = 7 then '修剪' |
| | | when type = 8 then '浸种' |
| | | when type = 9 then '拌种' |
| | | when type = 10 then '移栽' |
| | | when type = 11 then '直播' |
| | | when type = 12 then '采收' |
| | | else '其他' end as name, |
| | | ifnull(count(*), 0) value |
| | | from sys_farming_record |
| | | where 1=1 |
| | | and YEAR(time)=YEAR(NOW()) |
| | | and YEAR (time)= YEAR (NOW()) |
| | | and dept_id=#{deptId} |
| | | group by type |
| | | </select> |
| | | |
| | | <!--今年农资使用量--> |
| | | <select id="selectJyCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS jynum |
| | | FROM sys_farming_record |
| | | WHERE |
| | | YEAR ( time ) = YEAR ( NOW( ) ) |
| | | AND stock_id != NULL |
| | | and dept_id=#{deptId} |
| | | </select> |
| | | <!--去年农资使用量--> |
| | | <select id="selectQyCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS qynum |
| | | FROM sys_farming_record |
| | | WHERE |
| | | YEAR (time) = YEAR ( date_sub(now() |
| | | , INTERVAL 1 YEAR)) |
| | | and dept_id=#{deptId} |
| | | </select> |
| | | |
| | | <!--本月农资使用量--> |
| | | <select id="selectByCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS bynum |
| | | FROM sys_farming_record |
| | | WHERE DATE_FORMAT(time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | and dept_id = #{deptId} |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | Farm getFarmInfo(FarmVO farm); |
| | | Integer selectCountFarm(); |
| | | Integer selectCountUser(); |
| | | } |
| | |
| | | * 查询统计本年农事记录操作总数 |
| | | * @return |
| | | */ |
| | | Object getFarmingCount(); |
| | | Object getFarmingCount(String deptId); |
| | | |
| | | /** |
| | | * 查询统计本年农事记录操作,按分类统计 |
| | | * @return |
| | | */ |
| | | Object getFarmingStatis(); |
| | | |
| | | Object getFarmingStatis(String deptId); |
| | | //今年农资使用量 |
| | | Double selectJyCount(String deptId); |
| | | //去年农资使用量 |
| | | Double selectQyCount(String deptId); |
| | | //本月农资使用量 |
| | | Double selectByCount(String deptId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getFarmingCount() { |
| | | return baseMapper.getFarmingCount(); |
| | | public Object getFarmingCount(String deptId) { |
| | | return baseMapper.getFarmingCount(deptId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getFarmingStatis() { |
| | | return baseMapper.getFarmingStatis(); |
| | | public Object getFarmingStatis(String deptId) { |
| | | return baseMapper.getFarmingStatis(deptId); |
| | | } |
| | | |
| | | @Override |
| | | public Double selectJyCount(String deptId) { |
| | | return baseMapper.selectJyCount(deptId); |
| | | } |
| | | |
| | | @Override |
| | | public Double selectQyCount(String deptId) { |
| | | return baseMapper.selectQyCount(deptId); |
| | | } |
| | | |
| | | @Override |
| | | public Double selectByCount(String deptId) { |
| | | return baseMapper.selectByCount(deptId); |
| | | } |
| | | } |
| | |
| | | public Farm getFarmInfo(FarmVO farm) { |
| | | return baseMapper.getFarmInfo(farm); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountFarm() { |
| | | return baseMapper.selectCountFarm(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountUser() { |
| | | return baseMapper.selectCountUser(); |
| | | } |
| | | } |
| | |
| | | //采收 |
| | | record.setType("12"); |
| | | record.setLandId(recovery.getLandId()); |
| | | record.setDeptId(recovery.getDeptId()); |
| | | record.setStrainId(recovery.getStrainId()); |
| | | record.setOperator(recovery.getOperator()); |
| | | Strain strain = strainService.getById(recovery.getStrainId()); |
| | |
| | | AND is_deleted = 0 |
| | | AND task_user = #{taskuser} |
| | | </select> |
| | | |
| | | |
| | | <!--任务监管 code=1(当天)--> |
| | | <select id="selectTask" resultType="java.util.HashMap"> |
| | | select a.order_hour as date, ifnull(b.num, 0) as num |
| | | from ( |
| | | SELECT 0 AS order_hour UNION ALL SELECT 1 AS order_hour UNION ALL |
| | | SELECT 2 AS order_hour UNION ALL SELECT 3 AS order_hour UNION ALL |
| | | SELECT 4 AS order_hour UNION ALL SELECT 5 AS order_hour UNION ALL |
| | | SELECT 6 AS order_hour UNION ALL SELECT 7 AS order_hour UNION ALL |
| | | SELECT 8 AS order_hour UNION ALL SELECT 9 AS order_hour UNION ALL |
| | | SELECT 10 AS order_hour UNION ALL SELECT 11 AS order_hour UNION ALL |
| | | SELECT 12 AS order_hour UNION ALL SELECT 13 AS order_hour UNION ALL |
| | | SELECT 14 AS order_hour UNION ALL SELECT 15 AS order_hour UNION ALL |
| | | SELECT 16 AS order_hour UNION ALL SELECT 17 AS order_hour UNION ALL |
| | | SELECT 18 AS order_hour UNION ALL SELECT 19 AS order_hour UNION ALL |
| | | SELECT 20 AS order_hour UNION ALL SELECT 21 AS order_hour UNION ALL |
| | | SELECT 22 AS order_hour UNION ALL SELECT 23 AS order_hour |
| | | ) as a |
| | | LEFT JOIN |
| | | ( |
| | | SELECT HOUR(create_time) AS order_hour, count(*) AS num FROM sys_task |
| | | WHERE create_time >= str_to_date('2022-06-29 00:00:00','%Y-%m-%d %T') |
| | | AND create_time<= str_to_date('2022-06-29 23:59:59','%Y-%m-%d %T') |
| | | GROUP BY order_hour |
| | | ) b ON a.order_hour=b.order_hour |
| | | |
| | | ORDER BY order_hour; |
| | | </select> |
| | | <!--任务监管 code=2(当月)--> |
| | | <select id="selectM" resultType="java.util.HashMap"> |
| | | SELECT lefttable.date, |
| | | IFNULL(righttable.m, '0') AS num |
| | | FROM ( |
| | | SELECT ADDDATE(y.FIRST, x.d - 1) AS date |
| | | FROM |
| | | ( |
| | | SELECT |
| | | 1 AS d UNION ALL |
| | | SELECT |
| | | 2 UNION ALL |
| | | SELECT |
| | | 3 UNION ALL |
| | | SELECT |
| | | 4 UNION ALL |
| | | SELECT |
| | | 5 UNION ALL |
| | | SELECT |
| | | 6 UNION ALL |
| | | SELECT |
| | | 7 UNION ALL |
| | | SELECT |
| | | 8 UNION ALL |
| | | SELECT |
| | | 9 UNION ALL |
| | | SELECT |
| | | 10 UNION ALL |
| | | SELECT |
| | | 11 UNION ALL |
| | | SELECT |
| | | 12 UNION ALL |
| | | SELECT |
| | | 13 UNION ALL |
| | | SELECT |
| | | 14 UNION ALL |
| | | SELECT |
| | | 15 UNION ALL |
| | | SELECT |
| | | 16 UNION ALL |
| | | SELECT |
| | | 17 UNION ALL |
| | | SELECT |
| | | 18 UNION ALL |
| | | SELECT |
| | | 19 UNION ALL |
| | | SELECT |
| | | 20 UNION ALL |
| | | SELECT |
| | | 21 UNION ALL |
| | | SELECT |
| | | 22 UNION ALL |
| | | SELECT |
| | | 23 UNION ALL |
| | | SELECT |
| | | 24 UNION ALL |
| | | SELECT |
| | | 25 UNION ALL |
| | | SELECT |
| | | 26 UNION ALL |
| | | SELECT |
| | | 27 UNION ALL |
| | | SELECT |
| | | 28 UNION ALL |
| | | SELECT |
| | | 29 UNION ALL |
| | | SELECT |
| | | 30 UNION ALL |
| | | SELECT |
| | | 31 |
| | | ) x, |
| | | ( SELECT CONCAT( '2022-06', '-01' ) AS FIRST, DAY ( LAST_DAY( str_to_date( '2022-06-01', '%Y-%m-%d' ) ) ) AS |
| | | last ) y |
| | | WHERE |
| | | x.d<= y.last |
| | | AND ADDDATE( y.FIRST |
| | | , x.d - 1 ) <= CURDATE( ) |
| | | ) AS lefttable |
| | | LEFT JOIN ( |
| | | SELECT IFNULL(COUNT(*), 0) AS m, |
| | | DATE_FORMAT(create_time, '%Y-%c-%d') AS gptime |
| | | FROM sys_task |
| | | WHERE DATE_FORMAT(create_time, '%Y%m') = '202206' |
| | | GROUP BY gptime |
| | | ) AS righttable ON DATE_FORMAT(lefttable.date, '%Y-%c-%d') = righttable.gptime |
| | | </select> |
| | | <!--任务监管 code=3(当年)--> |
| | | <select id="selectY" resultType="java.util.HashMap"> |
| | | SELECT IFNULL(COUNT(*), 0) AS num, |
| | | DATE_FORMAT(create_time, "%Y-%m-%d") as date |
| | | FROM |
| | | sys_task |
| | | WHERE 1=1 and YEAR (create_time)=#{time}; |
| | | </select> |
| | | </mapper> |