接口前置插件,证书计算剩余有效天数,日志记录
This commit is contained in:
		
							parent
							
								
									dab0a04b59
								
							
						
					
					
						commit
						09309e9039
					
				|  | @ -0,0 +1,32 @@ | |||
| package tqq9.lc123.cloud.app.api.plugin; | ||||
| 
 | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.openapi.api.plugin.ApiSavePlugin; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 动态表单插件 | ||||
|  */ | ||||
| public class RecBillSavePlugin extends AbstractFormPlugin implements ApiSavePlugin { | ||||
|     @Override | ||||
|     public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) { | ||||
|         for (Map<String, Object> reqDatum : reqData) { | ||||
|             String tqq9_salorder = (String) reqDatum.get("tqq9_salorder");//销售订单 | ||||
|             BigDecimal actrecamt = (BigDecimal) reqDatum.get("actrecamt");//收款金额 | ||||
|             ArrayList<HashMap<String, Object>> entries = new ArrayList<HashMap<String, Object>>(); | ||||
|             HashMap<String, Object> map=new HashMap<>(); | ||||
|             map.put("tqq9_salorder", tqq9_salorder); | ||||
|             map.put("e_receivableamt", actrecamt); | ||||
|             entries.add(map); | ||||
|             reqDatum.put("entry",entries); | ||||
|         } | ||||
|         return ApiSavePlugin.super.preHandleRequestData(reqData); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,73 @@ | |||
| package tqq9.lc123.cloud.app.api.utils; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.http.HttpEntity; | ||||
| import org.springframework.http.HttpHeaders; | ||||
| import org.springframework.http.HttpMethod; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.client.RestTemplate; | ||||
| import org.springframework.web.util.UriComponentsBuilder; | ||||
| 
 | ||||
| import javax.json.JsonObject; | ||||
| import java.net.ConnectException; | ||||
| import java.util.Base64; | ||||
| import java.util.HashMap; | ||||
| 
 | ||||
| public class HttpClient { | ||||
|     private static String URL; | ||||
|     private static String USERNAME; | ||||
|     private static String PASSWORD; | ||||
|     static { | ||||
|         DynamicObject URL = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", | ||||
|                 new QFilter[]{new QFilter("number", QCP.equals, "FinanceHub_Token_Url")}); | ||||
|         DynamicObject userName = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", | ||||
|                 new QFilter[]{new QFilter("number", QCP.equals, "FinanceHub_Token_Username ")}); | ||||
|         USERNAME = userName != null ? userName.getString("rbkj_value") : null; | ||||
|         DynamicObject passWord = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", | ||||
|                 new QFilter[]{new QFilter("number", QCP.equals, "FinanceHub_Token_Password")}); | ||||
|         PASSWORD = passWord != null ? passWord.getString("rbkj_value") : null; | ||||
|     } | ||||
| 
 | ||||
|     private static RestTemplate restTemplate = new RestTemplate(); | ||||
|     private final static Log logger = LogFactory.getLog(HttpClient.class); | ||||
| 
 | ||||
|     public static ResponseEntity doPost(String url, Object body,String token_name ,String token_access) throws ConnectException { | ||||
|         HttpHeaders headers = new HttpHeaders(); | ||||
|         if (StringUtils.isNotBlank(token_access)) { | ||||
|             headers.set(token_name, token_access); | ||||
|         } | ||||
|         headers.set("Content-Type", "application/json;charset=UTF-8"); | ||||
|         headers.set("Accept", "application/json;charset=UTF-8"); | ||||
|         UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url); | ||||
|         HttpEntity<String> requestEntity = new HttpEntity(JSON.toJSONString(body), headers); | ||||
|         ResponseEntity<String> responseEntity = restTemplate.exchange(builder.build().toString(), HttpMethod.POST, requestEntity, String.class); | ||||
|         return responseEntity; | ||||
|     } | ||||
|     public static String Bearer_Token() throws ConnectException { | ||||
|         // 创建 Basic Auth 认证头 | ||||
|         String auth = USERNAME + ":" + PASSWORD; | ||||
| 
 | ||||
|         // 使用 Base64 编码进行认证 | ||||
|         String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes()); | ||||
| 
 | ||||
|         // 创建请求头 | ||||
| //        Authorization:Basic encodedAuth | ||||
|         HttpHeaders headers = new HttpHeaders(); | ||||
|         headers.set("Authorization", "Basic " + encodedAuth); | ||||
|         HashMap<String, String> body = new HashMap<>(); | ||||
|         body.put("sid","ERP"); | ||||
|         ResponseEntity responseEntity = doPost(URL, body, null, null); | ||||
|         Object responseEntityBody = responseEntity.getBody(); | ||||
|         JSONObject jsonObject1 = JSON.parseObject(responseEntity.getBody().toString()); | ||||
|         String accessToken = jsonObject1.get("accessToken").toString(); | ||||
|         return accessToken; | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,33 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.conm; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.form.FormShowParameter; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
| 
 | ||||
| /** | ||||
|  * 返利规则表单插件 | ||||
|  * 同步采购合同信息 | ||||
|  */ | ||||
| public class RebateRulesBillPlugin extends AbstractBillPlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(RebateRulesBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterCreateNewData(EventObject e) { | ||||
|         // 获取当前页面的FormShowParameter对象 | ||||
|         FormShowParameter formShowParameter = this.getView().getFormShowParameter(); | ||||
|         // 获取自定义参数 | ||||
|         String billno = (String)formShowParameter.getCustomParam("purcontract_billno"); | ||||
|         // 把参数值赋值到页面文本字段上 | ||||
|         DynamicObject purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("billno", QCP.equals, billno)}); | ||||
|         this.getModel().setValue("tqq9_conm_purcontract", purcontract); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -1,11 +1,19 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.conm; | ||||
| 
 | ||||
| import kd.bos.bill.BillShowParameter; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.form.CloseCallBack; | ||||
| import kd.bos.form.FormShowParameter; | ||||
| import kd.bos.form.ShowType; | ||||
| import kd.bos.form.control.events.BeforeItemClickEvent; | ||||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import kd.bos.form.events.ClosedCallBackEvent; | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
|  | @ -16,35 +24,31 @@ import java.util.Map; | |||
|  * 点击按钮新增返利规则 | ||||
|  */ | ||||
| public class purconmAddRebateRulesPlugin extends AbstractFormPlugin implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(purconmAddRebateRulesPlugin.class); | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         this.addItemClickListeners("tqq9_pur_rebate"); | ||||
|         this.addItemClickListeners("tbmain"); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeItemClick(BeforeItemClickEvent evt) { | ||||
|         super.beforeItemClick(evt); | ||||
|     public void itemClick(ItemClickEvent evt) { | ||||
|         super.itemClick(evt); | ||||
|         String itemKey = evt.getItemKey(); | ||||
|         if ("tqq9_pur_rebate".equals(itemKey)) { | ||||
|             FormShowParameter param = new FormShowParameter(); | ||||
| //            FormShowParameter param = new FormShowParameter(); | ||||
|             BillShowParameter param = new BillShowParameter(); | ||||
|             param.setFormId("tqq9_pur_rebate"); | ||||
|             param.setCloseCallBack(new CloseCallBack(this, "syncFilter")); | ||||
|             param.setCustomParam("purcontract_billno", this.getModel().getValue("billno")); | ||||
|             param.setCloseCallBack(new CloseCallBack(this, "rebateSync")); | ||||
|             param.getOpenStyle().setShowType(ShowType.Modal); | ||||
|             this.getView().showForm(param); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { | ||||
|         super.closedCallBack(closedCallBackEvent); | ||||
|         if (closedCallBackEvent.getActionId().equals("syncFilter")) { | ||||
|             Object returnData = closedCallBackEvent.getReturnData(); | ||||
|             if (returnData != null) { | ||||
|                 Map data = (Map) returnData; | ||||
|                 //调用接口同步数据 | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,76 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.im; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.LocaleString; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.datamodel.events.ChangeData; | ||||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
| import kd.bos.form.field.BasedataEdit; | ||||
| import kd.bos.form.field.ComboEdit; | ||||
| import kd.bos.form.field.ComboItem; | ||||
| import kd.bos.form.field.events.BeforeF7SelectEvent; | ||||
| import kd.bos.form.field.events.BeforeF7SelectListener; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.form.conm.purconmAddRebateRulesPlugin; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.EventObject; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 表单通用插件 | ||||
|  * 行政区划:省市区过滤插件 | ||||
|  */ | ||||
| public class AreaSelectionBillPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener { | ||||
|     private final static Log logger = LogFactory.getLog(AreaSelectionBillPlugin.class); | ||||
| 
 | ||||
|     private final static String PROVINCE = "tqq9_province"; | ||||
|     private final static String CITY = "tqq9_city"; | ||||
|     private final static String DISTRICT = "tqq9_district"; | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
| 
 | ||||
|         // 侦听基础资料字段的事件 | ||||
|         BasedataEdit Basedata_city = this.getView().getControl(CITY); | ||||
|         BasedataEdit Basedata_district = this.getView().getControl(DISTRICT); | ||||
|         Basedata_city.addBeforeF7SelectListener(this); | ||||
|         Basedata_district.addBeforeF7SelectListener(this); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) { | ||||
|         String key = beforeF7SelectEvent.getProperty().getName(); | ||||
|         if (StringUtils.equals(CITY, key)) { | ||||
|             DynamicObject tqq9_province = (DynamicObject) this.getModel().getValue(PROVINCE); | ||||
|             QFilter qFilter = null; | ||||
|             if (tqq9_province != null) { | ||||
|                 qFilter = new QFilter("parent.number", QCP.equals, tqq9_province.getString("number")); | ||||
|             } else { | ||||
|                 qFilter = new QFilter("parent.number", QCP.equals, "过滤全部筛选条件"); | ||||
|             } | ||||
|             beforeF7SelectEvent.addCustomQFilter(qFilter); | ||||
|         } else if (StringUtils.equals(DISTRICT, key)) { | ||||
|             DynamicObject tqq9_city = (DynamicObject) this.getModel().getValue(CITY); | ||||
|             QFilter qFilter = null; | ||||
| 
 | ||||
|             if (tqq9_city != null) { | ||||
|                 qFilter = new QFilter("parent.number", QCP.equals, tqq9_city.getString("number")); | ||||
|             } else { | ||||
|                 qFilter = new QFilter("parent.number", QCP.equals, "过滤全部筛选条件"); | ||||
|             } | ||||
|             beforeF7SelectEvent.addCustomQFilter(qFilter); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -1,19 +1,38 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.im; | ||||
| 
 | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.form.events.AfterDoOperationEventArgs; | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
| 
 | ||||
| /** | ||||
|  * 动态表单插件 | ||||
|  * 采购入库表单插件 | ||||
|  * 退货补货提示信息插件 | ||||
|  */ | ||||
| public class ReturnStockSyncNoticePlugin extends AbstractFormPlugin implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(ReturnStockSyncNoticePlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { | ||||
|         super.afterDoOperation(afterDoOperationEventArgs); | ||||
|         OperationResult operationResult = afterDoOperationEventArgs.getOperationResult(); | ||||
|         String message = operationResult.getMessage(); | ||||
|         System.out.println(111); | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         this.addItemClickListeners("tbmain"); | ||||
|     } | ||||
| 
 | ||||
| // | ||||
| //    @Override | ||||
| //    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { | ||||
| //        super.afterDoOperation(afterDoOperationEventArgs); | ||||
| //        String operateKey = afterDoOperationEventArgs.getOperateKey(); | ||||
| //        if(StringUtils.equals("audit",operateKey)){ | ||||
| // | ||||
| //        } | ||||
| //            OperationResult operationResult = afterDoOperationEventArgs.getOperationResult(); | ||||
| //        String message = operationResult.getMessage(); | ||||
| //        System.out.println(111); | ||||
| //    } | ||||
| } | ||||
|  | @ -7,10 +7,13 @@ import kd.bos.entity.datamodel.IDataModel; | |||
| import kd.bos.entity.datamodel.events.ChangeData; | ||||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.form.im.ReturnStockSyncNoticePlugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
| import java.util.Map; | ||||
|  | @ -23,6 +26,8 @@ import java.util.Map; | |||
|  * 需保持一致 | ||||
|  */ | ||||
| public class BaseDataPlugin extends AbstractFormPlugin implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(BaseDataPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterCreateNewData(EventObject e) { | ||||
|         super.afterCreateNewData(e); | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import kd.bos.bill.AbstractBillPlugIn; | |||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | ||||
|  | @ -14,6 +16,7 @@ import java.math.RoundingMode; | |||
|  */ | ||||
| public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { | ||||
| 
 | ||||
|     private final static Log logger = LogFactory.getLog(PuroderBillShareRefundPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void propertyChanged(PropertyChangedArgs e) { | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import kd.bos.bill.AbstractBillPlugIn; | |||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
|  | @ -14,6 +16,7 @@ import java.util.EventObject; | |||
|  */ | ||||
| public class PurorderEntryBtnPlugin extends AbstractBillPlugIn { | ||||
| 
 | ||||
|     private final static Log logger = LogFactory.getLog(PurorderEntryBtnPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|  |  | |||
|  | @ -28,6 +28,8 @@ import kd.bos.form.field.events.BeforeF7SelectEvent; | |||
| import kd.bos.form.field.events.BeforeF7SelectListener; | ||||
| import kd.bos.list.ListFilterParameter; | ||||
| import kd.bos.list.ListShowParameter; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.plugin.sample.dynamicform.pcform.field.template.PropertyChanged; | ||||
|  | @ -42,9 +44,12 @@ import java.util.EventObject; | |||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 采购订单界面插件 | ||||
|  * 点击付款计划分录付款单,弹出与预付款选择界面进行预付 | ||||
|  */ | ||||
| public class PurorderEntryIntroPaybillPlugin extends AbstractBillPlugIn implements HyperLinkClickListener { | ||||
|     private final static Log logger = LogFactory.getLog(PurorderEntryIntroPaybillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|  |  | |||
|  | @ -11,7 +11,10 @@ import kd.bos.entity.datamodel.events.ChangeData; | |||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
| import kd.bos.form.field.ComboEdit; | ||||
| import kd.bos.form.field.ComboItem; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.form.pm.PurorderEntryIntroPaybillPlugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.ArrayList; | ||||
|  | @ -19,9 +22,12 @@ import java.util.List; | |||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 单据界面插件 | ||||
|  * 客户界面插件 | ||||
|  * 基础资料根据结算方式过滤客户结算方式 | ||||
|  */ | ||||
| public class CustomerBillPlugin extends AbstractBillPlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(CustomerBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void propertyChanged(PropertyChangedArgs e) { | ||||
|         super.propertyChanged(e); | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import kd.bos.bill.AbstractBillPlugIn; | |||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| 
 | ||||
| import java.util.Date; | ||||
|  | @ -16,6 +18,7 @@ import java.util.Set; | |||
|  *      卫生许可证明细上的添加按钮 | ||||
|  */ | ||||
| public class ProxyAndFactoryBillPlugin extends AbstractBillPlugIn { | ||||
|     private final static Log logger = LogFactory.getLog(ProxyAndFactoryBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|  |  | |||
|  | @ -9,6 +9,8 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs; | |||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import kd.bos.form.field.ComboEdit; | ||||
| import kd.bos.form.field.ComboItem; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| 
 | ||||
|  | @ -19,6 +21,7 @@ import java.util.*; | |||
|  *      厂商许可证号动态添加下拉框选项 | ||||
|  */ | ||||
| public class RegistBillFactoryPlugin extends AbstractBillPlugIn { | ||||
|     private final static Log logger = LogFactory.getLog(RegistBillFactoryPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|  |  | |||
|  | @ -7,12 +7,15 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | |||
| import kd.bos.entity.plugin.AddValidatorsEventArgs; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.entity.validate.AbstractValidator; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.newdevportal.domaindefine.sample.validator.MyValidator; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.form.sys.RegistBillFactoryPlugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.HashMap; | ||||
|  | @ -23,6 +26,8 @@ import java.util.HashMap; | |||
|  * 2.审核插件:反写本次结算金额 | ||||
|  */ | ||||
| public class PurOrderReversePayBillPlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(PurOrderReversePayBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void onAddValidators(AddValidatorsEventArgs e) { | ||||
|         super.onAddValidators(e); | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import kd.bos.dataentity.entity.DynamicObject; | |||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
|  | @ -17,6 +19,8 @@ import java.math.BigDecimal; | |||
|  * 1.反审核插件:付款计划分录对应付款单的已结算金额转化为未结算金额 | ||||
|  */ | ||||
| public class PurOrderUnReversePayBillPlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(PurOrderUnReversePayBillPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterExecuteOperationTransaction(AfterOperationArgs e) { | ||||
|         super.afterExecuteOperationTransaction(e); | ||||
|  |  | |||
|  | @ -7,11 +7,14 @@ import kd.bos.entity.operate.result.IOperateInfo; | |||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.OperationServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.operate.cas.PurOrderUnReversePayBillPlugin; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | @ -20,6 +23,7 @@ import java.util.List; | |||
|  * 采购退货申请单(采购退补货)下推红字采购入库单审核后,根据来源的采购订单生成收货通知单 | ||||
|  */ | ||||
| public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(ReturnStockSyncNotifierPlugin.class); | ||||
|     @Override | ||||
|     public void afterExecuteOperationTransaction(AfterOperationArgs e) { | ||||
|         super.afterExecuteOperationTransaction(e); | ||||
|  | @ -45,11 +49,12 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI | |||
|                 } | ||||
| 
 | ||||
|                 OperateOption option = OperateOption.create(); | ||||
|                 OperationResult result = OperationServiceHelper.executeOperate("pushandsave", "pm_purorderbill", pm_purorderbills, option); | ||||
|                 OperationResult result = OperationServiceHelper.executeOperate("pushandsave1", "pm_purorderbill", pm_purorderbills, option); | ||||
|                 OperationResult operationResult1 = this.getOperationResult(); | ||||
|                 if (result.isSuccess()) { | ||||
|                     result.setMessage("系统已自动进行退货补货,相关收货通知单已自动生成,请手动调整补货数量,再提交审核"); | ||||
|                     operationResult1.setMessage("系统已自动进行退货补货,相关收货通知单已自动生成,请手动调整补货数量,再提交审核"); | ||||
|                 }else{ | ||||
|                     result.setMessage("补货失败,请手动操作"); | ||||
|                     operationResult1.setMessage("补货失败,请手动操作"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -0,0 +1,63 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.pm; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.PreparePropertysEventArgs; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.entity.plugin.args.BeforeOperationArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.plugin.sample.dynamicform.pcform.form.template.RegisterListener; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import org.junit.Before; | ||||
| import tqq9.lc123.cloud.app.plugin.operate.im.ReturnStockSyncNotifierPlugin; | ||||
| 
 | ||||
| /** | ||||
|  * 返利规则操作插件 | ||||
|  * 反写返利规则信息至采购合同 | ||||
|  */ | ||||
| public class RebateRulesReverPurOrderPlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(RebateRulesReverPurOrderPlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void onPreparePropertys(PreparePropertysEventArgs e) { | ||||
|         super.onPreparePropertys(e); | ||||
|         e.getFieldKeys().add("tqq9_conm_purcontract"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterExecuteOperationTransaction(AfterOperationArgs e) { | ||||
|         super.afterExecuteOperationTransaction(e); | ||||
|         String operationKey = e.getOperationKey(); | ||||
|         if (StringUtils.equals(operationKey, "save")) { | ||||
|             DynamicObject[] dataEntities = e.getDataEntities(); | ||||
|             for (DynamicObject dataEntity : dataEntities) { | ||||
|                 DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract"); | ||||
|                 if (tqq9_conm_purcontract != null) { | ||||
|                     DynamicObject conm_purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))}); | ||||
|                     conm_purcontract.set("tqq9_rebate", dataEntity); | ||||
|                     SaveServiceHelper.save(new DynamicObject[]{conm_purcontract}); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if (StringUtils.equals(operationKey, "delete")) { | ||||
|             DynamicObject[] dataEntities = e.getDataEntities(); | ||||
|             for (DynamicObject dataEntity : dataEntities) { | ||||
|                 DynamicObject tqq9_conm_purcontract = dataEntity.getDynamicObject("tqq9_conm_purcontract"); | ||||
|                 if (tqq9_conm_purcontract != null) { | ||||
|                     DynamicObject conm_purcontract = BusinessDataServiceHelper.loadSingle("conm_purcontract", new QFilter[]{new QFilter("id", QCP.equals, tqq9_conm_purcontract.getLong("id"))}); | ||||
|                     conm_purcontract.set("tqq9_rebate", null); | ||||
|                     SaveServiceHelper.save(new DynamicObject[]{conm_purcontract}); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,132 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.sys; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.PreparePropertysEventArgs; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.operate.pm.RebateRulesReverPurOrderPlugin; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.DateDifferenceCalculator; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| 
 | ||||
| /** | ||||
|  * 单据操作插件 | ||||
|  */ | ||||
| public class ValiddaysSavePlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(ValiddaysSavePlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void onPreparePropertys(PreparePropertysEventArgs e) { | ||||
|         super.onPreparePropertys(e); | ||||
|         e.getFieldKeys().add("tqq9_datefield1"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_ylqxsc"); | ||||
|         e.getFieldKeys().add("tqq9_datefield21"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_ylqxjy"); | ||||
|         e.getFieldKeys().add("tqq9_datefield4"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_ylqxjy2"); | ||||
|         e.getFieldKeys().add("tqq9_datefield22"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_yljg"); | ||||
|         e.getFieldKeys().add("tqq9_licenseenddate"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_hzp"); | ||||
|         e.getFieldKeys().add("tqq9_zlbzxyyxqz"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_zlbz"); | ||||
|         e.getFieldKeys().add("tqq9_datefield2"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_gmp"); | ||||
|         e.getFieldKeys().add("tqq9_datefield7"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_frsq"); | ||||
|         e.getFieldKeys().add("tqq9_datefield9"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_yyzz"); | ||||
|         e.getFieldKeys().add("tqq9_gspyxqz"); | ||||
|         e.getFieldKeys().add("tqq9_validdays_gsp"); | ||||
|         e.getFieldKeys().add("tqq9_enddate"); | ||||
|         e.getFieldKeys().add("tqq9_validdays"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterExecuteOperationTransaction(AfterOperationArgs e) { | ||||
|         super.afterExecuteOperationTransaction(e); | ||||
|         DynamicObject[] dataEntities = e.getDataEntities(); | ||||
|         for (DynamicObject dataEntity : dataEntities) { | ||||
|             String dynamicObjectType = dataEntity.getDynamicObjectType().getName(); | ||||
|             Date currentDate = new Date();//当前日期 | ||||
|             long remainingDays = 0; | ||||
|             if (StringUtils.equals(dynamicObjectType, "bd_supplier")) { | ||||
|                 //医疗器械生生产许可证 | ||||
|                 Date tqq9_datefield1 = dataEntity.getDate("tqq9_datefield1");//失效日期 | ||||
|                 if (tqq9_datefield1 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield1, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_ylqxsc", remainingDays); | ||||
|                 } | ||||
|                 //医疗器械经营许可证 | ||||
|                 Date tqq9_datefield21 = dataEntity.getDate("tqq9_datefield21");//失效日期 | ||||
|                 if (tqq9_datefield21 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield21, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_ylqxjy", remainingDays); | ||||
|                 } | ||||
|                 //第二类医疗器械经营备案凭证 | ||||
|                 Date tqq9_datefield4 = dataEntity.getDate("tqq9_datefield4");//失效日期 | ||||
|                 if (tqq9_datefield4 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield4, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_ylqxjy2", remainingDays); | ||||
|                 } | ||||
| 
 | ||||
|                 //医疗机构执行许可证 | ||||
|                 Date tqq9_datefield22 = dataEntity.getDate("tqq9_datefield22");//失效日期 | ||||
|                 if (tqq9_datefield22 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield22, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_yljg", remainingDays); | ||||
|                 } | ||||
|                 //化妆品许可证 | ||||
|                 Date tqq9_licenseenddate = dataEntity.getDate("tqq9_licenseenddate");//失效日期 | ||||
|                 if (tqq9_licenseenddate != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_licenseenddate, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_hzp", remainingDays); | ||||
|                 } | ||||
|                 //质量保证书 | ||||
|                 Date tqq9_zlbzxyyxqz = dataEntity.getDate("tqq9_zlbzxyyxqz");//失效日期 | ||||
|                 if (tqq9_zlbzxyyxqz != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_zlbzxyyxqz, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_zlbz", remainingDays); | ||||
|                 } | ||||
|                 //GMP证书 | ||||
|                 Date tqq9_datefield2 = dataEntity.getDate("tqq9_datefield2");//失效日期 | ||||
|                 if (tqq9_datefield2 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield2, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_gmp", remainingDays); | ||||
|                 } | ||||
|                 //法人委托授权书 | ||||
|                 Date tqq9_datefield7 = dataEntity.getDate("tqq9_datefield7");//失效日期 | ||||
|                 if (tqq9_datefield7 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield7, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_frsq", remainingDays); | ||||
|                 } | ||||
|                 //营业执照 | ||||
|                 Date tqq9_datefield9 = dataEntity.getDate("tqq9_datefield9");//失效日期 | ||||
|                 if (tqq9_datefield9 != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield9, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_yyzz", remainingDays); | ||||
|                 } | ||||
|                 //GSP证书 | ||||
|                 Date tqq9_gspyxqz = dataEntity.getDate("tqq9_gspyxqz");//失效日期 | ||||
|                 if (tqq9_gspyxqz != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_gspyxqz, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays_gsp", remainingDays); | ||||
|                 } | ||||
|             } else if (StringUtils.equals(dynamicObjectType, "tqq9_registration")) { | ||||
|                 //商品注册证 | ||||
|                 Date tqq9_enddate = dataEntity.getDate("tqq9_enddate");//失效日期 | ||||
|                 if (tqq9_enddate != null) { | ||||
|                     remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_enddate, currentDate); | ||||
|                     dataEntity.set("tqq9_validdays", remainingDays); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         SaveServiceHelper.save(dataEntities); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,110 @@ | |||
| package tqq9.lc123.cloud.app.plugin.task; | ||||
| 
 | ||||
| import kd.bos.context.RequestContext; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.exception.KDException; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.schedule.executor.AbstractTask; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.plugin.operate.sys.ValiddaysSavePlugin; | ||||
| import tqq9.lc123.cloud.app.plugin.utils.DateDifferenceCalculator; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 后台任务插件 | ||||
|  */ | ||||
| public class DaysRemaining extends AbstractTask implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(DaysRemaining.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException { | ||||
|         DynamicObject[] suppliers = BusinessDataServiceHelper.load("bd_supplier", "" + | ||||
|                 "id,number,name,tqq9_datefield1,tqq9_validdays_ylqxsc,tqq9_datefield21,tqq9_validdays_ylqxjy,tqq9_datefield4,tqq9_validdays_ylqxjy2,tqq9_datefield22," + | ||||
|                 "tqq9_validdays_yljg,tqq9_licenseenddate,tqq9_validdays_hzp,tqq9_zlbzxyyxqz,tqq9_validdays_zlbz,tqq9_datefield2,tqq9_validdays_gmp,tqq9_datefield7," + | ||||
|                 "tqq9_validdays_frsq,tqq9_datefield9,tqq9_validdays_yyzz,tqq9_gspyxqz,tqq9_validdays_gsp", null); | ||||
|         Date currentDate = new Date();//当前日期 | ||||
|         long remainingDays = 0; | ||||
|         for (DynamicObject supplier : suppliers) { | ||||
|             //医疗器械生生产许可证 | ||||
|             Date tqq9_datefield1 = supplier.getDate("tqq9_datefield1");//失效日期 | ||||
|             if (tqq9_datefield1 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield1, currentDate); | ||||
|                 supplier.set("tqq9_validdays_ylqxsc", remainingDays); | ||||
|             } | ||||
|             //医疗器械经营许可证 | ||||
|             Date tqq9_datefield21 = supplier.getDate("tqq9_datefield21");//失效日期 | ||||
|             if (tqq9_datefield21 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield21, currentDate); | ||||
|                 supplier.set("tqq9_validdays_ylqxjy", remainingDays); | ||||
|             } | ||||
|             //第二类医疗器械经营备案凭证 | ||||
|             Date tqq9_datefield4 = supplier.getDate("tqq9_datefield4");//失效日期 | ||||
|             if (tqq9_datefield4 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield4, currentDate); | ||||
|                 supplier.set("tqq9_validdays_ylqxjy2", remainingDays); | ||||
|             } | ||||
| 
 | ||||
|             //医疗机构执行许可证 | ||||
|             Date tqq9_datefield22 = supplier.getDate("tqq9_datefield22");//失效日期 | ||||
|             if (tqq9_datefield22 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield22, currentDate); | ||||
|                 supplier.set("tqq9_validdays_yljg", remainingDays); | ||||
|             } | ||||
|             //化妆品许可证 | ||||
|             Date tqq9_licenseenddate = supplier.getDate("tqq9_licenseenddate");//失效日期 | ||||
|             if (tqq9_licenseenddate != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_licenseenddate, currentDate); | ||||
|                 supplier.set("tqq9_validdays_hzp", remainingDays); | ||||
|             } | ||||
|             //质量保证书 | ||||
|             Date tqq9_zlbzxyyxqz = supplier.getDate("tqq9_zlbzxyyxqz");//失效日期 | ||||
|             if (tqq9_zlbzxyyxqz != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_zlbzxyyxqz, currentDate); | ||||
|                 supplier.set("tqq9_validdays_zlbz", remainingDays); | ||||
|             } | ||||
|             //GMP证书 | ||||
|             Date tqq9_datefield2 = supplier.getDate("tqq9_datefield2");//失效日期 | ||||
|             if (tqq9_datefield2 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield2, currentDate); | ||||
|                 supplier.set("tqq9_validdays_gmp", remainingDays); | ||||
|             } | ||||
|             //法人委托授权书 | ||||
|             Date tqq9_datefield7 = supplier.getDate("tqq9_datefield7");//失效日期 | ||||
|             if (tqq9_datefield7 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield7, currentDate); | ||||
|                 supplier.set("tqq9_validdays_frsq", remainingDays); | ||||
|             } | ||||
|             //营业执照 | ||||
|             Date tqq9_datefield9 = supplier.getDate("tqq9_datefield9");//失效日期 | ||||
|             if (tqq9_datefield9 != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_datefield9, currentDate); | ||||
|                 supplier.set("tqq9_validdays_yyzz", remainingDays); | ||||
|             } | ||||
|             //GSP证书 | ||||
|             Date tqq9_gspyxqz = supplier.getDate("tqq9_gspyxqz");//失效日期 | ||||
|             if (tqq9_gspyxqz != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_gspyxqz, currentDate); | ||||
|                 supplier.set("tqq9_validdays_gsp", remainingDays); | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|         } | ||||
|         DynamicObject[] tqq9_registration = BusinessDataServiceHelper.load("tqq9_registration", "id,number,name,tqq9_enddate,tqq9_validdays", null); | ||||
|         for (DynamicObject dynamicObject : tqq9_registration) { | ||||
|             //商品注册证 | ||||
|             Date tqq9_enddate = dynamicObject.getDate("tqq9_enddate");//失效日期 | ||||
|             if (tqq9_enddate != null) { | ||||
|                 remainingDays = DateDifferenceCalculator.calculateRemainingDays(tqq9_enddate, currentDate); | ||||
|                 dynamicObject.set("tqq9_validdays", remainingDays); | ||||
|             } | ||||
|         } | ||||
|         SaveServiceHelper.save(suppliers); | ||||
|         SaveServiceHelper.save(tqq9_registration); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,22 @@ | |||
| package tqq9.lc123.cloud.app.plugin.utils; | ||||
| 
 | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import tqq9.lc123.cloud.app.plugin.task.DaysRemaining; | ||||
| 
 | ||||
| import java.time.Instant; | ||||
| import java.time.temporal.ChronoUnit; | ||||
| import java.util.Date; | ||||
| 
 | ||||
| public class DateDifferenceCalculator { | ||||
|     private final static Log logger = LogFactory.getLog(DateDifferenceCalculator.class); | ||||
| 
 | ||||
|     // 计算两个日期之间的剩余天数 | ||||
|     public static long calculateRemainingDays(Date endDate, Date startDate) { | ||||
|         // 将 Date 转换为 Instant 类型 | ||||
|         Instant endInstant = endDate.toInstant(); | ||||
|         Instant startInstant = startDate.toInstant(); | ||||
|         // 使用 ChronoUnit.DAYS 计算日期之间的天数 | ||||
|         return ChronoUnit.DAYS.between(startInstant,endInstant); | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue