From b23dea952d3964c66d8823ebd3f84cabbe978eae Mon Sep 17 00:00:00 2001 From: czt <czt18638530771@163.com> Date: 星期四, 18 四月 2024 19:15:18 +0800 Subject: [PATCH] 增加统一编码管理页面及数据拉取 --- src/main/java/com/fzzy/api/entity/GbUnifiedCoding.java | 72 ++++++ src/main/java/com/fzzy/api/dto/RespGbCoding.java | 20 + src/main/java/com/fzzy/api/dto/ReqGbCoding.java | 23 + src/main/resources/templates/home/home.html | 3 src/main/java/com/fzzy/api/view/pr/GbUnifiedCodingPR.java | 141 +++++++++++ src/main/java/com/fzzy/api/dto/GbCodingData.java | 22 + src/main/java/com/fzzy/api/view/GbUnifiedCoding.view.xml | 414 ++++++++++++++++++++++++++++++++++ src/main/java/com/fzzy/api/view/repository/GbUnifiedCodingRep.java | 19 + 8 files changed, 714 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/fzzy/api/dto/GbCodingData.java b/src/main/java/com/fzzy/api/dto/GbCodingData.java new file mode 100644 index 0000000..0a8ab94 --- /dev/null +++ b/src/main/java/com/fzzy/api/dto/GbCodingData.java @@ -0,0 +1,22 @@ +package com.fzzy.api.dto; + +import com.fzzy.api.entity.GbUnifiedCoding; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 缁熶竴缂栫爜浜屽眰灏佽 + * @Author CZT + * @Date 2024/4/18 14:23 + */ +@Data +public class GbCodingData implements Serializable { + + public int total; + /** + * 璇存槑 + */ + public List<GbUnifiedCoding> list; +} diff --git a/src/main/java/com/fzzy/api/dto/ReqGbCoding.java b/src/main/java/com/fzzy/api/dto/ReqGbCoding.java new file mode 100644 index 0000000..ee973d5 --- /dev/null +++ b/src/main/java/com/fzzy/api/dto/ReqGbCoding.java @@ -0,0 +1,23 @@ +package com.fzzy.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author CZT + * @Date 2024/4/18 14:55 + */ +@Data +public class ReqGbCoding implements Serializable { + + public String dwdm; + + public ReqGbCoding() { + } + + public ReqGbCoding(String dwdm) { + this.dwdm = dwdm; + } +} diff --git a/src/main/java/com/fzzy/api/dto/RespGbCoding.java b/src/main/java/com/fzzy/api/dto/RespGbCoding.java new file mode 100644 index 0000000..5007251 --- /dev/null +++ b/src/main/java/com/fzzy/api/dto/RespGbCoding.java @@ -0,0 +1,20 @@ +package com.fzzy.api.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 缁熶竴缂栫爜杩斿洖鏁版嵁灏佽 + * @Author CZT + * @Date 2024/4/18 14:19 + */ +@Data +public class RespGbCoding<T> implements Serializable { + + public String code; + + public String msg; + + public T data; +} diff --git a/src/main/java/com/fzzy/api/entity/GbUnifiedCoding.java b/src/main/java/com/fzzy/api/entity/GbUnifiedCoding.java new file mode 100644 index 0000000..ee5e914 --- /dev/null +++ b/src/main/java/com/fzzy/api/entity/GbUnifiedCoding.java @@ -0,0 +1,72 @@ +package com.fzzy.api.entity; + +import com.bstek.dorado.annotation.PropertyDef; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 缁熶竴缂栫爜瀹炰綋绫� + * @Author CZT + * @Date 2024/4/18 9:56 + */ +@Data +@Entity +@Table(name = "GB_UNIFIED_CODING") +public class GbUnifiedCoding implements Serializable { + + @Id + @PropertyDef(label = "寤掗棿缂栫爜") + @Column(name = "ajdm", length = 40) + private String ajdm; + + @PropertyDef(label = "寤掗棿鍚嶇О") + @Column(name = "ajmc", length = 100) + private String ajmc; + + @PropertyDef(label = "鍗曚綅鍚嶇О") + @Column(name = "dwmc", length = 200) + private String dwmc; + + @PropertyDef(label = "鍗曚綅缂栫爜") + @Column(name = "frdwdm", length = 40) + private String frdwdm; + + @PropertyDef(label = "浼佷笟鎬ц川") + @Column(name = "qyxz", length = 10) + private String qyxz; + + @PropertyDef(label = "搴撳尯鍚嶇О") + @Column(name = "kqmc", length = 100) + private String kqmc; + + @PropertyDef(label = "搴撳尯缂栫爜") + @Column(name = "kqdm", length = 40) + private String kqdm; + + @PropertyDef(label = "浠撴埧缂栫爜") + @Column(name = "cfdm", length = 40) + private String cfdm; + + @PropertyDef(label = "浠撴埧鍚嶇О") + @Column(name = "cfmc", length = 100) + private String cfmc; + + @PropertyDef(label = "鍒涘缓鏃堕棿") + @Column(name = "createTime") + private Date createTime; + + @PropertyDef(label = "涓婄骇鍗曚綅鍚嶇О") + @Column(name = "sjDeptName", length = 200) + private String sjDeptName; + + @PropertyDef(label = "鏇存柊鏃堕棿") + @Column(name = "updateTime") + private Date updateTime; + +} diff --git a/src/main/java/com/fzzy/api/view/GbUnifiedCoding.view.xml b/src/main/java/com/fzzy/api/view/GbUnifiedCoding.view.xml new file mode 100644 index 0000000..04d9a6e --- /dev/null +++ b/src/main/java/com/fzzy/api/view/GbUnifiedCoding.view.xml @@ -0,0 +1,414 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ViewConfig> + <Arguments/> + <Context/> + <Model> + <DataType name="dtMain"> + <Property name="creationType">com.fzzy.api.entity.GbUnifiedCoding</Property> + <PropertyDef name="ajdm"> + <Property></Property> + <Property name="label">寤掗棿缂栫爜</Property> + </PropertyDef> + <PropertyDef name="ajmc"> + <Property></Property> + <Property name="label">寤掗棿鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="dwmc"> + <Property></Property> + <Property name="label">鍗曚綅鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="frdwdm"> + <Property></Property> + <Property name="label">鍗曚綅缂栫爜</Property> + </PropertyDef> + <PropertyDef name="qyxz"> + <Property></Property> + <Property name="label">浼佷笟鎬ц川</Property> + <Property name="mapping"> + <Property name="keyProperty">code</Property> + <Property name="valueProperty">name</Property> + <Property name="mapValues"> + <Collection> + <Entity> + <Property name="code">10</Property> + <Property name="name">10-涓偍绮洿灞炰紒涓�(鍖呮嫭鍒嗗簱鍙婃帶鑲′紒涓�)</Property> + </Entity> + <Entity> + <Property name="code">20</Property> + <Property name="name">20-鍏朵粬涓ぎ浼佷笟(涓伯銆佷緵閿�銆佷腑鍖栫瓑锛屼笉鍚浠撳簱鐐�)</Property> + </Entity> + <Entity> + <Property name="code">30</Property> + <Property name="name">30-鐪佸睘鍥芥湁鍙婂浗鏈夋帶鑲′紒涓�</Property> + </Entity> + <Entity> + <Property name="code">31</Property> + <Property name="name">31-甯傚睘鍥芥湁鍙婂浗鏈夋帶鑲′紒涓�</Property> + </Entity> + <Entity> + <Property name="code">32</Property> + <Property name="name">32-鍘跨骇鍥芥湁鍙婂浗鏈夋帶鑲′紒涓�</Property> + </Entity> + <Entity> + <Property name="code">40</Property> + <Property name="name">40-姘戣惀鍙婂叾浠栭潪鍥芥湁鎺ц偂鑲′唤鍒朵紒涓�</Property> + </Entity> + <Entity> + <Property name="code">50</Property> + <Property name="name">50-澶栬祫浼佷笟</Property> + </Entity> + </Collection> + </Property> + </Property> + </PropertyDef> + <PropertyDef name="kqmc"> + <Property></Property> + <Property name="label">搴撳尯鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="kqdm"> + <Property></Property> + <Property name="label">搴撳尯缂栫爜</Property> + </PropertyDef> + <PropertyDef name="cfdm"> + <Property></Property> + <Property name="label">浠撴埧缂栫爜</Property> + </PropertyDef> + <PropertyDef name="cfmc"> + <Property></Property> + <Property name="label">浠撴埧鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="createTime"> + <Property name="dataType">DateTime</Property> + <Property name="label">鍒涘缓鏃堕棿</Property> + </PropertyDef> + <PropertyDef name="sjDeptName"> + <Property></Property> + <Property name="label">涓婄骇鍗曚綅鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="updateTime"> + <Property name="dataType">DateTime</Property> + <Property name="label">鏇存柊鏃堕棿</Property> + </PropertyDef> + </DataType> + <DataType name="dtParam"> + <PropertyDef name="dwmc"> + <Property></Property> + <Property name="label">鍗曚綅鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="kqmc"> + <Property></Property> + <Property name="label">搴撳尯鍚嶇О</Property> + </PropertyDef> + <PropertyDef name="ajmc"> + <Property></Property> + <Property name="label">寤掗棿鍚嶇О</Property> + </PropertyDef> + </DataType> + <DataType name="dtParam2"> + <Property name="creationType">com.fzzy.api.data.ApiParam</Property> + <PropertyDef name="dwdm"> + <Property></Property> + <Property name="label">鍗曚綅淇℃伅</Property> + <Property name="required">true</Property> + <Property name="mapping"> + <Property name="mapValues">${dorado.getDataProvider("api1101PR#listAll").getResult()}</Property> + <Property name="keyProperty">dwdm</Property> + <Property name="valueProperty">dwmc</Property> + </Property> + </PropertyDef> + </DataType> + </Model> + <View layout="regionPadding:10"> + <Property name="packages">font-awesome,css-common</Property> + <DataSet id="dsMain"> + <Property name="dataType">[dtMain]</Property> + <Property name="dataProvider">gbUnifiedCodingPR#pageList</Property> + <Property name="pageSize">20</Property> + </DataSet> + <DataSet id="dsQuery"> + <ClientEvent name="onReady">self.insert();</ClientEvent> + <Property name="dataType">dtParam</Property> + </DataSet> + <DataSet id="dsQuery2"> + <ClientEvent name="onReady">self.insert();</ClientEvent> + <Property name="dataType">dtParam2</Property> + </DataSet> + <AutoForm> + <Property name="dataSet">dsQuery</Property> + <Property name="cols">*,*,*,500px</Property> + <Property name="labelAlign">right</Property> + <Property name="labelSeparator">锛�</Property> + <Property name="labelWidth">90</Property> + <AutoFormElement> + <Property name="name">dwmc</Property> + <Property name="property">dwmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">kqmc</Property> + <Property name="property">kqmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">ajmc</Property> + <Property name="property">ajmc</Property> + <Editor/> + </AutoFormElement> + <ToolBar> + <ToolBarButton> + <ClientEvent name="onClick">var query = view.get("#dsQuery").getData();
 +view.get("#dsMain").set("parameter",query).flushAsync();</ClientEvent> + <Property name="caption">鏌ヨ</Property> + <Property name="iconClass">fa fa-search</Property> + <Property name="width">100</Property> + <Property name="exClassName">toolbar-button-push</Property> + </ToolBarButton> + <ToolBarButton> + <ClientEvent name="onClick">var cur = view.get("#dgMain").getCurrentItem();
 +if(cur){
 + view.get("#dialogMain").show();
 +}else{
 + $alert("璇峰嬀閫夋兂瑕佹煡鐪嬬殑鏁版嵁锛�");
 +}
 +</ClientEvent> + <Property name="caption">璇︽儏</Property> + <Property name="iconClass">fa fa-search</Property> + <Property name="width">100</Property> + <Property name="exClassName">toolbar-button</Property> + <Property name="hideMode">display</Property> + <Property name="visible">true</Property> + </ToolBarButton> + <ToolBarButton> + <ClientEvent name="onClick">var cur = view.get("#dgMain").getCurrentItem();
 +view.get("#ajaxDel").set("parameter",cur).execute(function(result){
 + if(result){
 + $alert(result);
 + } else{
 + cur.remove();
 + }
 +});
 +</ClientEvent> + <Property name="caption">鍒犻櫎</Property> + <Property name="iconClass">fa fa-minus</Property> + <Property name="exClassName">toolbar-button-warn</Property> + <Property name="width">100</Property> + <Property name="visible">true</Property> + <Property name="hideMode">display</Property> + </ToolBarButton> + <ToolBarButton> + <ClientEvent name="onClick">view.get("#dialogPull").show();</ClientEvent> + <Property name="caption">鎷夊彇缁熶竴缂栫爜</Property> + <Property name="iconClass">fa fa-minus</Property> + <Property name="exClassName">toolbar-button-warm</Property> + <Property name="width">150</Property> + </ToolBarButton> + </ToolBar> + </AutoForm> + <DataGrid id="dgMain"> + <Property name="dataSet">dsMain</Property> + <Property name="selectionMode">multiRows</Property> + <Property name="readOnly">true</Property> + <RowNumColumn/> + <RowSelectorColumn> + <Property name="caption">涓婁紶</Property> + </RowSelectorColumn> + <DataColumn> + <Property name="property">ajdm</Property> + <Property name="align">center</Property> + <Property name="name">ajdm</Property> + <Property name="width">240</Property> + </DataColumn> + <DataColumn> + <Property name="property">ajmc</Property> + <Property name="align">center</Property> + <Property name="name">ajmc</Property> + <Property name="width">100</Property> + </DataColumn> + <DataColumn> + <Property name="property">cfdm</Property> + <Property name="align">center</Property> + <Property name="name">cfdm</Property> + <Property name="width">220</Property> + </DataColumn> + <DataColumn> + <Property name="property">cfmc</Property> + <Property name="align">center</Property> + <Property name="name">cfmc</Property> + <Property name="width">100</Property> + </DataColumn> + <DataColumn> + <Property name="property">kqdm</Property> + <Property name="visible">true</Property> + <Property name="align">center</Property> + <Property name="name">kqdm</Property> + <Property name="width">200</Property> + </DataColumn> + <DataColumn> + <Property name="property">kqmc</Property> + <Property name="name">kqmc</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn> + <Property name="property">frdwdm</Property> + <Property name="name">frdwdm</Property> + <Property name="width">190</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn> + <Property name="property">qyxz</Property> + <Property name="name">qyxz</Property> + <Property name="align">center</Property> + </DataColumn> + <DataColumn> + <Property name="property">updateTime</Property> + <Property name="name">updateTime</Property> + <Property name="align">center</Property> + <Property name="width">150</Property> + </DataColumn> + </DataGrid> + <ToolBar layoutConstraint="bottom"> + <Fill/> + <DataPilot> + <Property name="itemCodes">pageSize,pages</Property> + <Property name="dataSet">dsMain</Property> + </DataPilot> + </ToolBar> + <Dialog id="dialogMain"> + <Property name="width">1000</Property> + <Property name="caption">璇︾粏淇℃伅</Property> + <Property name="iconClass">fa fa-sliders</Property> + <Property name="closeable">false</Property> + <Property name="height">90%</Property> + <Buttons> + <Button> + <ClientEvent name="onClick">var cur = view.get("#dgMain").getCurrentItem();
 +self.get("parent").hide();
 +if(cur) cur.cancel();</ClientEvent> + <Property name="caption">鍏抽棴</Property> + <Property name="iconClass">fa fa-times</Property> + <Property name="exClassName">toolbar-button-warn</Property> + </Button> + </Buttons> + <Children> + <AutoForm> + <Property name="dataSet">dsMain</Property> + <Property name="cols">*,*</Property> + <Property name="labelWidth">100</Property> + <Property name="labelAlign">left</Property> + <Property name="labelSeparator">锛�</Property> + <Property name="labelPosition">top</Property> + <AutoFormElement> + <Property name="name">ajdm</Property> + <Property name="property">ajdm</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">ajmc</Property> + <Property name="property">ajmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">cfdm</Property> + <Property name="property">cfdm</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">cfmc</Property> + <Property name="property">cfmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">kqdm</Property> + <Property name="property">kqdm</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">kqmc</Property> + <Property name="property">kqmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">frdwdm</Property> + <Property name="property">frdwdm</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">dwmc</Property> + <Property name="property">dwmc</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">qyxz</Property> + <Property name="property">qyxz</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">sjDeptName</Property> + <Property name="property">sjDeptName</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">createTime</Property> + <Property name="property">createTime</Property> + <Editor/> + </AutoFormElement> + <AutoFormElement> + <Property name="name">updateTime</Property> + <Property name="property">updateTime</Property> + <Editor/> + </AutoFormElement> + </AutoForm> + </Children> + <Tools/> + </Dialog> + <Dialog id="dialogPull"> + <Property name="width">600</Property> + <Property name="caption">缁熶竴缂栫爜鏁版嵁鎷夊彇</Property> + <Buttons> + <Button> + <ClientEvent name="onClick">var data = view.get("#dsQuery2.data");
 +
 +if (data.validate() != 'ok') {
 + $alert("璇峰~鍐欏畬鎴愬弬鏁�");
 + return;
 +}
 +
 +var dwdm = data.get("dwdm");
 +
 +view.get("#ajaxPullData").set("parameter",dwdm).execute(function(result){
 + view.get("#dialogPull").hide();
 + $alert(result);
 +});</ClientEvent> + <Property name="caption">纭鎵ц</Property> + <Property name="iconClass">fa fa-check</Property> + <Property name="exClassName">toolbar-button</Property> + </Button> + <Button> + <ClientEvent name="onClick">self.get("parent").hide();</ClientEvent> + <Property name="caption">鍙栨秷鍏抽棴</Property> + <Property name="iconClass">fa fa-times</Property> + <Property name="exClassName">toolbar-button-warn</Property> + </Button> + </Buttons> + <Children> + <AutoForm> + <Property name="dataSet">dsQuery2</Property> + <Property name="cols">*</Property> + <AutoFormElement layoutConstraint="colSpan:2"> + <Property name="name">dwdm</Property> + <Property name="property">dwdm</Property> + <Editor/> + </AutoFormElement> + </AutoForm> + </Children> + <Tools/> + </Dialog> + <AjaxAction id="ajaxDel"> + <Property name="service">gbUnifiedCodingPR#delData</Property> + <Property name="confirmMessage">褰撳墠鏁版嵁鍒犻櫎鍚庢棤娉曟仮澶嶏紝璇风‘璁よ鍒犻櫎涔堬紵</Property> + </AjaxAction> + <AjaxAction id="ajaxPullData"> + <Property name="service">gbUnifiedCodingPR#pullData</Property> + </AjaxAction> + </View> +</ViewConfig> diff --git a/src/main/java/com/fzzy/api/view/pr/GbUnifiedCodingPR.java b/src/main/java/com/fzzy/api/view/pr/GbUnifiedCodingPR.java new file mode 100644 index 0000000..4770c01 --- /dev/null +++ b/src/main/java/com/fzzy/api/view/pr/GbUnifiedCodingPR.java @@ -0,0 +1,141 @@ +package com.fzzy.api.view.pr; + +import com.alibaba.fastjson.JSONObject; +import com.bstek.dorado.annotation.DataProvider; +import com.bstek.dorado.annotation.Expose; +import com.bstek.dorado.data.provider.Page; +import com.fzzy.api.dto.GbCodingData; +import com.fzzy.api.dto.ReqGbCoding; +import com.fzzy.api.dto.RespGbCoding; +import com.fzzy.api.entity.GbUnifiedCoding; +import com.fzzy.api.view.repository.GbUnifiedCodingRep; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @Description 缁熶竴缂栫爜鏁版嵁绠$悊 + * @Author CZT + * @Date 2024/4/18 10:28 + */ +@Slf4j +@Component +public class GbUnifiedCodingPR { + + private static final String GB_CODING_URL = "http://121.36.17.6:28088/admin-api/coding/fmxx/queryDataInfo"; + @Autowired + private GbUnifiedCodingRep codingRep; + @Autowired + private RestTemplate restTemplate; + + /** + * gbUnifiedCodingPR#pageList + * + * @return + */ + @SuppressWarnings("serial") + @DataProvider + public void pageList(Page<GbUnifiedCoding> page, Map<String, Object> param) { + //澶氬弬鏁板垎椤垫煡璇� + Pageable pageable = PageRequest.of(page.getPageNo() - 1, page.getPageSize(), Sort.Direction.DESC, "updateTime"); + + if (null == param) { + org.springframework.data.domain.Page<GbUnifiedCoding> japPage = codingRep.findAll(pageable); + page.setEntityCount((int) japPage.getTotalElements()); + page.setEntities(japPage.getContent()); + + return; + } + + Specification<GbUnifiedCoding> specification = new Specification<GbUnifiedCoding>() { + public Predicate toPredicate(Root<GbUnifiedCoding> root, CriteriaQuery<?> query, CriteriaBuilder cb) { + List<Predicate> predicates = new ArrayList<Predicate>(); //鎵�鏈夌殑鏂█ + + String str = (String) param.get("ajmc"); + if (StringUtils.isNotBlank(str)) { + Predicate predicate1 = cb.equal(root.get("ajmc"), str); + predicates.add(predicate1); + } + str = (String) param.get("cfmc"); + if (StringUtils.isNotBlank(str)) { + Predicate predicate2 = cb.equal(root.get("cfmc"),str); + predicates.add(predicate2); + } + str = (String) param.get("kqmc"); + if (StringUtils.isNotBlank(str)) { + Predicate predicate3 = cb.equal(root.get("kqmc"),str); + predicates.add(predicate3); + } + return cb.and(predicates.toArray(new Predicate[0])); + } + }; + + log.debug("---------鍒嗛〉鍙傛暟鏌ヨ----------{}", param.toString()); + org.springframework.data.domain.Page<GbUnifiedCoding> japPage = codingRep.findAll(specification, pageable); + page.setEntityCount((int) japPage.getTotalElements()); + page.setEntities(japPage.getContent()); + } + + /** + * gbUnifiedCodingPR#delData + * + * @param data + */ + @Expose + public String delData(GbUnifiedCoding data) { + + codingRep.deleteById(data.getAjdm()); + + return null; + } + + /** + * gbUnifiedCodingPR#pullData + * 鎷夊彇缁熶竴缂栫爜鏁版嵁 + * + * @param dwdm + * @return + */ + @Expose + public String pullData(String dwdm) { + + if (StringUtils.isEmpty(dwdm)) { + return "鎵ц澶辫触锛氬崟浣嶇紪鐮佷负绌猴紝璇锋牳鏌ワ紒"; + } + + //璁剧疆鍙傛暟 + ReqGbCoding reqGbCoding = new ReqGbCoding(dwdm); + RespGbCoding respGbCoding = restTemplate.postForObject(GB_CODING_URL, reqGbCoding, RespGbCoding.class); + if(null == respGbCoding){ + return "鎷夊彇鏁版嵁澶辫触锛岃閲嶈瘯锛�"; + } + if(!"0".equals(respGbCoding.getCode())){ + return respGbCoding.getMsg(); + } + GbCodingData data = JSONObject.parseObject(JSONObject.toJSONString(respGbCoding.getData()), GbCodingData.class); + if(null == data || data.getList().isEmpty()){ + return "鎷夊彇鏁版嵁涓虹┖锛岃閲嶈瘯锛�"; + } + for (GbUnifiedCoding gbUnifiedCoding : data.getList()) { + gbUnifiedCoding.setUpdateTime(new Date()); + gbUnifiedCoding.setQyxz(gbUnifiedCoding.getFrdwdm().substring(0, 2)); + codingRep.save(gbUnifiedCoding); + } + + return "鍚屾鍛戒护鍙戦�佸畬鎴愶紝璇风◢绛夊埛鏂版暟鎹煡鐪�"; + } +} diff --git a/src/main/java/com/fzzy/api/view/repository/GbUnifiedCodingRep.java b/src/main/java/com/fzzy/api/view/repository/GbUnifiedCodingRep.java new file mode 100644 index 0000000..420c2e6 --- /dev/null +++ b/src/main/java/com/fzzy/api/view/repository/GbUnifiedCodingRep.java @@ -0,0 +1,19 @@ +package com.fzzy.api.view.repository; + +import com.fzzy.api.entity.GbUnifiedCoding; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +/** + * @Description + * @Author CZT + * @Date 2024/4/18 10:30 + */ +public interface GbUnifiedCodingRep extends JpaRepository<GbUnifiedCoding, String>, JpaSpecificationExecutor<GbUnifiedCoding> { + + +} diff --git a/src/main/resources/templates/home/home.html b/src/main/resources/templates/home/home.html index 837a850..d1bbbbe 100644 --- a/src/main/resources/templates/home/home.html +++ b/src/main/resources/templates/home/home.html @@ -98,6 +98,9 @@ <dd> <a lay-href="com.fzzy.sys.User.d">鐢ㄦ埛绠$悊</a> </dd> + <dd> + <a lay-href="com.fzzy.api.view.GbUnifiedCoding.d">缁熶竴缂栫爜绠$悊</a> + </dd> </dl> </li> -- Gitblit v1.9.3