多单位版国产化地质资料管理系统
zs
2026-02-04 fe02f176b512a9d6a4e12437d929e04e99bb7567
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.zbooksoft.gdmis.operate;
 
import com.ruili.wcp.common.SpringContextUtil;
import com.ruili.wcp.data.entity.config.View;
import com.ruili.wcp.service.config.ViewService;
import com.ruili.wcp.web.model.AjaxResponse;
import com.ruili.wcp.web.model.ErrorInfo;
import com.zbooksoft.gdmis.data.entity.CatAjjxx;
import com.zbooksoft.gdmis.service.CatSmxxService;
import com.zbooksoft.gdmis.service.CatYswjxxService;
import com.zbooksoft.gdmis.service.PackingManageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
 
/**
 * @Description:原始文件信息操作方法
 * @Author: zhai
 * @Date: 2024/8/15
 **/
public class TransferOperate {
    private static final Logger logger = LoggerFactory.getLogger(TransferOperate.class);
    CatYswjxxService catYswjxxService = (CatYswjxxService) SpringContextUtil.getBean("catYswjxxServiceImpl");
    CatSmxxService catSmxxService = (CatSmxxService) SpringContextUtil.getBean("catSmxxServiceImpl");
    PackingManageService packingManageService = (PackingManageService) SpringContextUtil.getBean("packingManageServiceImpl");
    ViewService viewService = (ViewService) SpringContextUtil.getBean("viewServiceImpl");
    JdbcTemplate jdbcTemplate = (JdbcTemplate) SpringContextUtil.getBean("jdbcTemplate");
 
    /**
     * 提交验收
     *
     * @param viewId
     * @param idList
     * @return
     */
    public AjaxResponse submitCheck(Long viewId, ArrayList<Long> idList) {
 
        View view = viewService.getViewById(viewId);
        int state = 2;
        try {
            String strSql = "update " + view.getMainTableName() + " set yszt = " + state + " where id = " + idList.get(0);
            jdbcTemplate.execute(strSql);
            String selectCountSql = "select count(*) from CAT_ITEM_YSWJXX where YJ_ID = " + idList.get(0) + " and (WJLJ = '' or  WJLJ is null)";
            int count = jdbcTemplate.queryForObject(selectCountSql, Integer.class);
            if (count > 0) {
                return new AjaxResponse(new ErrorInfo("存在未关联文件,请先关联附件!"), false);
            }
            String updateSql = "update CAT_ITEM_YSWJXX set yszt = " + state + " where  YJ_ID =" + idList.get(0);
            jdbcTemplate.execute(updateSql);
            return new AjaxResponse(true);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
        }
    }
 
    /**
     * 验收后中数据进行撤回
     *
     * @param viewId
     * @param idList
     * @return
     */
    public AjaxResponse revocationCheck(Long viewId, ArrayList<Long> idList) {
 
        View view = viewService.getViewById(viewId);
        int state = 0;
        try {
            String strSql = "update " + view.getMainTableName() + " set yszt = " + state + " where id = " + idList.get(0);
            jdbcTemplate.execute(strSql);
            String updateSql = "update CAT_ITEM_YSWJXX set yszt = " + state + " where  YJ_ID =" + idList.get(0);
            jdbcTemplate.execute(updateSql);
            return new AjaxResponse(true);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
        }
    }
 
    /**
     * 接收到实体资料后确认验收合格
     *
     * @param viewId
     * @param idList
     * @return
     */
    public AjaxResponse qualified(Long viewId, ArrayList<Long> idList) {
        try {
            String updateSqlY = "update CAT_ITEM_YSWJXX set YSZT = '3' where YJ_ID = " + idList.get(0);
            jdbcTemplate.execute(updateSqlY);
            return new AjaxResponse(true);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}