| | |
| | | import com.yc.action.grid.GridUtils; |
| | | import net.sf.json.JSONArray; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFCell; |
| | | import org.apache.poi.hssf.usermodel.HSSFCellStyle; |
| | | import org.apache.poi.hssf.usermodel.HSSFDataFormat; |
| | |
| | | import org.springframework.jdbc.support.rowset.SqlRowSet; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yc.action.grid.PoiExcelWriter; |
| | | import com.yc.entity.Json38; |
| | | import com.yc.service.new38type.Type38Impl.ExcelPO; |
| | | import com.yc.service.new38type.Type38Impl.Pov; |
| | | import com.yc.service.BaseService; |
| | | import com.yc.utils.JOSNUtils; |
| | | import com.yc.utils.Page; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | |
| | | import com.yc.utils.DateUtil; |
| | | |
| | | |
| | | |
| | | @Service("type38Impl") |
| | | public class Type38Impl extends BaseService implements Type38Ifc{ |
| | | |
| | | //获得总记录数 |
| | | public static final String COUNT = "select count(formId) from _sysStatis"; |
| | | public static final String COUNT = "set nocount on; select count(formId) from _sysStatis"; |
| | | //统计设计获取总记录数 |
| | | public static final String COUNTS = "select count(formId) from _sysStatisDetail"; |
| | | public static final String COUNTS = "set nocount on; select count(formId) from _sysStatisDetail"; |
| | | //private static final String DELETE_PANEL_DATA = "delete _sysStatis where formid in ? and StatisID in ?"; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selecttype(int formid,String usercode) { |
| | | public List<Map<String, Object>> selecttype(int formid, String usercode, String statisIds) { |
| | | // TODO Auto-generated method stub |
| | | String sql="select formID,StatisID,StatisName,activedyn,usercode from _sysStatis where formid="+formid+" and isnull(usercode,'') in ('',"+"'"+usercode+"'"+") order by usercode asc ,StatisID asc"; |
| | | String statisidList=""; |
| | | if(StringUtils.isNotBlank(statisIds)){ |
| | | statisidList=" and isnull(StatisID,'') in ( select list from getinstr('"+statisIds+"')) "; |
| | | } |
| | | String sql="set nocount on; select formID,StatisID,StatisName,activedyn,usercode from _sysStatis where formid="+formid+" and isnull(usercode,'') in ('',"+"'"+usercode+"'"+") "+statisidList+" order by usercode asc ,StatisID asc"; |
| | | return this.jdbcTemplate.queryForList(sql); |
| | | } |
| | | @Override |
| | |
| | | }else{ |
| | | filter = " formId like '"+formId+"%'"; |
| | | } |
| | | String sql = "select count(formId) from _sysStatis where "+filter; |
| | | String sql = "set nocount on; select count(formId) from _sysStatis where "+filter; |
| | | SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); |
| | | if(rs.next()){ |
| | | return rs.getInt(1); |
| | |
| | | public List<Map<String, Object>> getAllPanelDatas(int curPage, int pageSize) { |
| | | |
| | | // TODO Auto-generated method stub |
| | | String sql = "select top "+pageSize+" * from _sysStatis where (StatisName not in (select top " |
| | | String sql = "set nocount on; select top "+pageSize+" * from _sysStatis where (StatisName not in (select top " |
| | | +(pageSize*(curPage-1))+" StatisName from _sysStatis order by formid)) order by formid"; |
| | | |
| | | return this.jdbcTemplate.queryForList(sql); |
| | |
| | | filter = " formId like '"+formId+"%'"; |
| | | } |
| | | |
| | | String sql = "select top "+pageSize+" * from _sysStatis where (StatisName not in (select top " |
| | | String sql = "set nocount on; select top "+pageSize+" * from _sysStatis where (StatisName not in (select top " |
| | | +(pageSize*(curPage-1))+" StatisName from _sysStatis where "+filter+" order by formid))" + |
| | | " and("+filter+") order by formid"; |
| | | return this.jdbcTemplate.queryForList(sql); |
| | |
| | | }else{ |
| | | filter = " formId like '"+formId+"%'"; |
| | | } |
| | | String sql = "select count(formId) from _sysStatisDetail where "+filter; |
| | | String sql = "set nocount on; select count(formId) from _sysStatisDetail where "+filter; |
| | | SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); |
| | | if(rs.next()){ |
| | | return rs.getInt(1); |
| | |
| | | @Override |
| | | public List<Map<String, Object>> getAllPanelDatass(int curPage, int pageSize,String tj) { |
| | | // TODO Auto-generated method stub |
| | | String sql = "select top "+pageSize+" * from _sysStatisDetail where (FieldCaption not in (select top " |
| | | String sql = "set nocount on; select top "+pageSize+" * from _sysStatisDetail where (FieldCaption not in (select top " |
| | | +(pageSize*(curPage-1))+" FieldCaption from _sysStatisDetail order by formid))"+tj+" order by formid"; |
| | | |
| | | return this.jdbcTemplate.queryForList(sql); |
| | |
| | | filter = " formId like '"+formId+"%'"; |
| | | } |
| | | |
| | | String sql = "select top "+pageSize+" * from _sysStatisDetail where (FieldCaption not in (select top " |
| | | String sql = "set nocount on; select top "+pageSize+" * from _sysStatisDetail where (FieldCaption not in (select top " |
| | | +(pageSize*(curPage-1))+" FieldCaption from _sysStatisDetail where "+filter+" order by formid))" + |
| | | " and("+filter+") order by formid"; |
| | | return this.jdbcTemplate.queryForList(sql); |
| | |
| | | |
| | | } |
| | | } |
| | | sql="INSERT INTO _sysStatis ([FormID],[StatisID],[StatisName],[activedyn],[usercode])values("+"'"+formid+"'"+","+"'"+saisid+"'"+","+"'"+saisid+"'"+",'1',"+"'"+usercode+"'"+") "+sql; |
| | | sql="set nocount on; INSERT INTO _sysStatis ([FormID],[StatisID],[StatisName],[activedyn],[usercode])values("+"'"+formid+"'"+","+"'"+saisid+"'"+","+"'"+saisid+"'"+",'1',"+"'"+usercode+"'"+") "+sql; |
| | | this.jdbcTemplate.update(sql); |
| | | } |
| | | @Override |
| | |
| | | // TODO Auto-generated method stub |
| | | JSONArray json = JSONArray.fromObject(data.getData()); |
| | | Map<String,Object>map=null; |
| | | String sql=""; |
| | | String sql="set nocount on; "; |
| | | for(int i =0;i<json.size();i++){ |
| | | map=(Map<String, Object>) json.get(i); |
| | | String fieldalias=(map.get("fieldalias")==null||map.get("fieldalias").equals(""))?"''":"'"+GridUtils.prossRowSetDataType_String(map,"fieldalias")+"'"; |