| | |
| | | private Timestamp endDeadline; |
| | | private Integer status; |
| | | private Integer favor; |
| | | private boolean favorFlag; |
| | | private List<ApplyStatus> statusSelectList; |
| | | |
| | | private LazyDataModel<SysReagent> reagentDataModel; |
| | | private LazyDataModel<SysReagent> reagentFavorDataModel; |
| | | private String applyNewReagentName; |
| | | private String applyNewCas; |
| | | private String applyNewSn; |
| | | private SysReagent selectReagent; |
| | | |
| | | public boolean isFavorFlag() { |
| | | return favorFlag; |
| | | } |
| | | |
| | | public void setFavorFlag(boolean favorFlag) { |
| | | this.favorFlag = favorFlag; |
| | | } |
| | | |
| | | |
| | | public SysReagent getSelectReagent() { |
| | | return selectReagent; |
| | |
| | | public List<SysReagent> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { |
| | | List<SysReagent> list = null; |
| | | try { |
| | | int count = sysReagentService.getSysReagentTotalCount2(getUser(),favorFlag ? 1 :null,applyNewReagentName, applyNewCas, applyNewSn,null); |
| | | int count = sysReagentService.favorCount(getUser(), applyNewReagentName, applyNewCas, null, applyNewSn, 0); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysReagentService.getSysReagentList2(getUser(),favorFlag ? 1 : null,applyNewReagentName, applyNewCas, applyNewSn,null, first, pageSize); |
| | | list = sysReagentService.favorList(getUser(), applyNewReagentName, applyNewCas, null, applyNewSn, 0, first, pageSize); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | |
| | | } |
| | | |
| | | return reagentDataModel; |
| | | } |
| | | |
| | | |
| | | public LazyDataModel<SysReagent> getReagentFavorDataModel() { |
| | | if (this.reagentFavorDataModel == null) { |
| | | this.reagentFavorDataModel = new LazyDataModel<SysReagent>() { |
| | | @Override |
| | | public List<SysReagent> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { |
| | | List<SysReagent> list = null; |
| | | try { |
| | | int count = sysReagentService.favorCount(getUser(), null, null, null,null,1); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysReagentService.favorList(getUser(),null, null,null, null,1, first, pageSize); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public SysReagent getRowData(String rowKey) { |
| | | Iterator<SysReagent> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | SysReagent sr = null; |
| | | while (iterator.hasNext()) { |
| | | sr = iterator.next(); |
| | | if (rowKey.equals(sr.getId())) { |
| | | return sr; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | return reagentFavorDataModel; |
| | | } |
| | | |
| | | public LazyDataModel<OpeApply> getApplyHistoryDataModel() { |
| | |
| | | } |
| | | |
| | | |
| | | public Integer getFavor() { |
| | | return favor; |
| | | } |
| | | |
| | | public void setFavor(Integer favor) { |
| | | this.favor = favor; |
| | | } |
| | | } |
| | |
| | | public int deleteSysReagent(List<String> ids) throws DataAccessException; |
| | | |
| | | public List<SysReagent> query(); |
| | | |
| | | //试剂库总数 |
| | | int reagentCount(Map params); |
| | | int favorCount(Map params); |
| | | List<SysReagent> favorList(Map params); |
| | | Map getSysReagentDetail(String id); |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="reagentList" parameterType="java.util.Map" resultType="int"> |
| | | select sr.*, ss.meta_value as product_home_name, bm.meta_value as control_products_name,supplier.name as supplierName,f.id favor,f.create_time favortime |
| | | from sys_reagent as sr |
| | | left join base_meta as ss on sr.product_home = ss.id |
| | | left join base_meta bm on bm.id = sr.control_products |
| | | left join sys_supplier supplier on supplier.id = sr.supplier_id |
| | | LEFT JOIN favor f on f.reagent_id = sr.id AND f.user_id = #{user} |
| | | where sr.valid_flag = 1 |
| | | <if test="cas != null and cas != ''"> |
| | | and sr.cas = #{cas} |
| | | </if> |
| | | <if test="supplierId != null and supplierId != ''"> |
| | | and sr.supplier_id = #{supplierId} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and sr.name like concat("%", #{name} ,"%") |
| | | </if> |
| | | <if test="productSn != null and productSn != ''"> |
| | | and sr.product_sn = #{productSn} |
| | | </if> |
| | | ORDER BY sr.create_time desc |
| | | <if test="first != null and pageSize != null"> |
| | | limit #{first}, #{pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="favorList" parameterType="java.util.Map" resultMap="SysReagent"> |
| | | select sr.*, ss.meta_value as product_home_name, bm.meta_value as control_products_name,supplier.name as supplierName,f.id favor,f.create_time favortime |
| | | from sys_reagent as sr |
| | | left join base_meta as ss on sr.product_home = ss.id |
| | | left join base_meta bm on bm.id = sr.control_products |
| | | left join sys_supplier supplier on supplier.id = sr.supplier_id |
| | | LEFT JOIN favor f on f.reagent_id = sr.id AND f.user_id = #{user} |
| | | where sr.valid_flag = 1 |
| | | <choose> |
| | | <when test="favorFlag != ''"> |
| | | and f.id is not null |
| | | </when> |
| | | <otherwise> |
| | | and f.id is null |
| | | </otherwise> |
| | | </choose> |
| | | <if test="cas != null and cas != ''"> |
| | | and sr.cas = #{cas} |
| | | </if> |
| | | <if test="supplierId != null and supplierId != ''"> |
| | | and sr.supplier_id = #{supplierId} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and sr.name like concat("%", #{name} ,"%") |
| | | </if> |
| | | <if test="productSn != null and productSn != ''"> |
| | | and sr.product_sn = #{productSn} |
| | | </if> |
| | | <choose> |
| | | <when test="favorFlag != ''"> |
| | | ORDER BY favortime desc |
| | | </when> |
| | | <otherwise> |
| | | ORDER BY sr.create_time desc |
| | | </otherwise> |
| | | </choose> |
| | | <if test="first != null and pageSize != null"> |
| | | limit #{first}, #{pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="favorCount" parameterType="java.util.Map" resultType="int"> |
| | | select count(1) |
| | | from sys_reagent as sr |
| | | left join base_meta as ss on sr.product_home = ss.id |
| | | left join base_meta bm on bm.id = sr.control_products |
| | | left join sys_supplier supplier on supplier.id = sr.supplier_id |
| | | LEFT JOIN favor f on f.reagent_id = sr.id AND f.user_id = #{user} |
| | | where sr.valid_flag = 1 |
| | | <choose> |
| | | <when test="favorFlag != ''"> |
| | | and f.id is not null |
| | | </when> |
| | | <otherwise> |
| | | and f.id is null |
| | | </otherwise> |
| | | </choose> |
| | | <if test="cas != null and cas != ''"> |
| | | and sr.cas = #{cas} |
| | | </if> |
| | | <if test="supplierId != null and supplierId != ''"> |
| | | and sr.supplier_id = #{supplierId} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and sr.name like concat("%", #{name} ,"%") |
| | | </if> |
| | | <if test="productSn != null and productSn != ''"> |
| | | and sr.product_sn = #{productSn} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getSysReagentListNew" parameterType="java.util.Map" resultMap="SysReagent"> |
| | | select sr.*, ss.meta_value as product_home_name, ifnull(w.reserve,0) as reserve, bm.meta_value as control_products_name,supplier.name as supplierName |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="reagentCount" parameterType="java.util.Map" resultType="int"> |
| | | select count(1) |
| | | from sys_reagent as sr |
| | | left join base_meta as ss on sr.product_home = ss.id |
| | | left join base_meta bm on bm.id = sr.control_products |
| | | left join (select reagent_id, sum(reserve) reserve from ope_warehouse_reserve where valid_flag = 1 group by reagent_id) w on w.reagent_id = sr.id |
| | | |
| | | left join sys_supplier supplier on supplier.id = sr.supplier_id |
| | | LEFT JOIN favor f on f.reagent_id = sr.id AND f.user_id = #{user} |
| | | where sr.valid_flag = 1 |
| | | <include refid="queryWhereSql"/> |
| | | <if test="favor != null and favor != '' "> |
| | | and f.id is not null |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getSysReagentTotalCountNew" parameterType="java.util.Map" resultType="int"> |
| | | select count(1) |
| | | from sys_reagent as sr |
| | |
| | | public boolean deleteSysReagent(List<SysReagent> sysReagentList); |
| | | public int insertSysReagentList(List<SysReagent> sysReagentList); |
| | | public int insertSysReagentList2(List<SysReagent> sysReagentList); |
| | | public List<SysReagent> getSysReagentList2(SysUser user,Integer favorFlag, String name, String cas, String productSn, String supplierId, Integer first, Integer pageSize); |
| | | public int getSysReagentTotalCount2(SysUser user,Integer favorFlag,String name, String cas,String productSn, String supplierId); |
| | | |
| | | int getSysReagentTotalCountNew(String name, String cas, String supplierId, Integer type); |
| | | public List<SysReagent> query(); |
| | |
| | | Map getReagentDetail(String id); |
| | | |
| | | public List<SysReagent> getSysReagentListNew(String name, String cas, String supplierId, Integer type, Integer first, Integer pageSize); |
| | | |
| | | int favorCount(SysUser user, String name, String cas, String supplierId, String productSn,Integer favorFlag); |
| | | |
| | | List<SysReagent> favorList(SysUser user, String name, String cas, String supplierId, String productSn,Integer favorFlag, Integer first, Integer pageSize); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @Description: 收藏与未收藏 0未收藏 1收藏 统计个数 |
| | | * @date 2020/12/1 17:04 |
| | | */ |
| | | @Override |
| | | public int favorCount(SysUser user, String name, String cas, String supplierId, String productSn, Integer favorFlag) { |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("user", user.getId()); |
| | | params.put("favorFlag", favorFlag); |
| | | params.put("name", name); |
| | | params.put("cas", cas); |
| | | params.put("supplierId", supplierId); |
| | | params.put("productSn", productSn); |
| | | return sysReagentDao.favorCount(params); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 收藏与未收藏 0未收藏 1收藏 统计详情 |
| | | * @date 2020/12/1 17:04 |
| | | */ |
| | | @Override |
| | | public List<SysReagent> favorList(SysUser user, String name, String cas, String supplierId, String productSn, Integer favorFlag, Integer first, Integer pageSize) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("user", user.getId()); |
| | | params.put("favorFlag", favorFlag); |
| | | params.put("name", name); |
| | | params.put("cas", cas); |
| | | params.put("supplierId", supplierId); |
| | | params.put("productSn", productSn); |
| | | params.put("first", first); |
| | | params.put("pageSize", pageSize); |
| | | return sysReagentDao.favorList(params); |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public int getSysReagentTotalCount(String name, String cas, String supplierId,Integer type) { |
| | |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public List<SysReagent> getSysReagentList2(SysUser user,Integer favorFlag, String name, String cas, String productSn, String supplierId, Integer first, Integer pageSize) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | if (StringUtils.isNotBlank(name)) { |
| | | params.put("name", "%" + name + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(cas)) { |
| | | params.put("cas", "%" + cas + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(supplierId)) { |
| | | params.put("supplierId", supplierId); |
| | | } |
| | | if (StringUtils.isNotBlank(productSn)) { |
| | | params.put("productSn","%"+ productSn+"%"); |
| | | } |
| | | |
| | | params.put("user", user.getId()); |
| | | params.put("favor", favorFlag); |
| | | params.put("first", first); |
| | | params.put("pageSize", pageSize); |
| | | return this.sysReagentDao.getSysReagentList(params); |
| | | } catch (DataAccessException e) { |
| | | logger.error(e.getMessage(), e); |
| | | throw new BusinessException(ExceptionEnumCode.DB_ERR, MessageUtil.getMessageByCode(ExceptionEnumCode.DB_ERR.getCode()), e); |
| | | } |
| | | } |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public int getSysReagentTotalCount2(SysUser user,Integer favorFlag, String name, String cas,String productSn, String supplierId) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | if (StringUtils.isNotBlank(name)) { |
| | | params.put("name", "%" + name + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(cas)) { |
| | | params.put("cas", "%" + cas + "%"); |
| | | } |
| | | if (StringUtils.isNotBlank(productSn)) { |
| | | params.put("productSn","%"+ productSn+"%"); |
| | | } |
| | | params.put("user", user.getId()); |
| | | params.put("favor", favorFlag); |
| | | params.put("supplierId", supplierId); |
| | | return this.sysReagentDao.getSysReagentTotalCount(params); |
| | | } catch (DataAccessException e) { |
| | | logger.error(e.getMessage(), e); |
| | | throw new BusinessException(ExceptionEnumCode.DB_ERR, MessageUtil.getMessageByCode(ExceptionEnumCode.DB_ERR.getCode()), e); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public SysReagent getSysReagent(String id) { |
| | |
| | | </h:form> |
| | | <br/> |
| | | <p:tabView dynamic="true" style="margin-left: 26px"> |
| | | <p:tab title="我的收藏"> |
| | | <h:form id="myFavor"> |
| | | <p:dataTable id="favorDataTable" styleClass="data-table" style="margin-left: 2px" |
| | | resizableColumns="true" paginator="true" paginatorAlwaysVisible="false" paginatorPosition="bottom" |
| | | lazy="true" value="#{applyMngController.reagentFavorDataModel}" var="row" rowKey="#{row.id}" |
| | | emptyMessage="请添加收藏" selectionMode="single" |
| | | rows="50" pageLinks="5"> |
| | | |
| | | <p:ajax event="rowDblselect" listener="#{applyMngController.onReagentRowSelect}" update=":applyMngNewForm,:applyDialog"></p:ajax> |
| | | <p:column headerText="产品编号"> |
| | | <h:outputText value="#{row.productSn}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="试剂名称"> |
| | | <h:outputText value="#{row.name}"></h:outputText> |
| | | <h:outputText value="收藏" readonly="true" rendered="#{row.favor!=null}" styleClass="favor"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="管制品"> |
| | | <h:outputText value="#{baseMetaService.getBaseMetaValue(row.controlProducts)}"></h:outputText> |
| | | </p:column> |
| | | <!--<p:column headerText="试剂类型">--> |
| | | <!--<h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagentType)}"></h:outputText>--> |
| | | <!--</p:column>--> |
| | | <!--<p:column headerText="危险性质">--> |
| | | <!--<h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagentCharacter)}"></h:outputText>--> |
| | | <!--</p:column>--> |
| | | <!-- <p:column headerText="供应商"> |
| | | <h:outputText value="#{row.supplierName}"></h:outputText> |
| | | </p:column>--> |
| | | <p:column headerText="规格型号"> |
| | | <h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagentFormat)}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="包装"> |
| | | <h:outputText value="#{''.concat(row.mainMetering).concat(baseMetaService.getBaseMetaValue(row.reagentUnit))}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="含税售价"> |
| | | <h:outputText value="#{row.price}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="CAS号"> |
| | | <h:outputText value="#{row.cas}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="危险性质"> |
| | | <h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagentCharacter)}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="厂家"> |
| | | <h:outputText value="#{row.productHomeName}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="试剂类型"> |
| | | <h:outputText value="#{baseMetaService.getBaseMetaValue(row.reagentType)}"></h:outputText> |
| | | </p:column> |
| | | <p:column headerText="操作" style="text-align: center;"> |
| | | <h:commandButton styleClass="favor-btn-common #{row.favor == null?'favor-btn':'not-favor-btn'}" value="#{row.favor == null?'加入收藏':'取消收藏'}" update="@this"> |
| | | <f:setPropertyActionListener value="#{row}" target="#{applyMngController.selectReagent}" /> |
| | | </h:commandButton> |
| | | |
| | | </p:column> |
| | | </p:dataTable> |
| | | </h:form> |
| | | |
| | | </p:tab> |
| | | <p:tab title="试剂库"> |
| | | <h:form id="applyMngNewReagentForm"> |
| | | <p:panelGrid styleClass="apply-mng-new-reagent-filter" columns="9" style="margin-left: -18px"> |
| | |
| | | <p:inputText value="#{applyMngController.applyNewCas}"></p:inputText> |
| | | <p:outputLabel value="产品编号:"></p:outputLabel> |
| | | <p:inputText value="#{applyMngController.applyNewSn}"></p:inputText> |
| | | <p:outputLabel value="我的收藏: " /> |
| | | <p:inputSwitch value="#{applyMngController.favorFlag}" styleClass="toggle-class"/> |
| | | <p:commandLink styleClass="search" process="@form" update="@form"></p:commandLink> |
| | | </p:panelGrid> |
| | | |