Browse Source

提交开源材料

10.0
LAPTOP-SB56SG4Q\86185 3 years ago
parent
commit
3925d6dd7e
  1. BIN
      JSD-7843配置使用文档.docx
  2. 5
      README.md
  3. BIN
      jsd-7843-需求确认书.docx
  4. BIN
      lib/finekit-10.0.jar
  5. 25
      plugin.xml
  6. 33
      src/main/java/com/fr/plugin/j7843/sso/LifeCycleMonitorImpl.java
  7. 37
      src/main/java/com/fr/plugin/j7843/sso/LocaleFinder.java
  8. 66
      src/main/java/com/fr/plugin/j7843/sso/ProcessDBAccess.java
  9. 128
      src/main/java/com/fr/plugin/j7843/sso/bean/CstDataBean.java
  10. 104
      src/main/java/com/fr/plugin/j7843/sso/bean/DataResponse.java
  11. 57
      src/main/java/com/fr/plugin/j7843/sso/config/SsoConfig.java
  12. 49
      src/main/java/com/fr/plugin/j7843/sso/dao/CstDataDao.java
  13. 46
      src/main/java/com/fr/plugin/j7843/sso/dao/CstStatusDao.java
  14. 143
      src/main/java/com/fr/plugin/j7843/sso/entity/CstDataEntity.java
  15. 163
      src/main/java/com/fr/plugin/j7843/sso/entity/CstStatusEntity.java
  16. 112
      src/main/java/com/fr/plugin/j7843/sso/request/ServiceController.java
  17. 26
      src/main/java/com/fr/plugin/j7843/sso/request/ServiceControllerBridge.java
  18. 7
      src/main/resources/com/fr/plugin/j7843/sso/locale/lang.properties
  19. 7
      src/main/resources/com/fr/plugin/j7843/sso/locale/lang_zh_CN.properties

BIN
JSD-7843配置使用文档.docx

Binary file not shown.

5
README.md

@ -1,3 +1,6 @@
# open-JSD-7843 # open-JSD-7843
JSD-7843 开源材料 jsd-7843 开源材料\
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。

BIN
jsd-7843-需求确认书.docx

Binary file not shown.

BIN
lib/finekit-10.0.jar

Binary file not shown.

25
plugin.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>com.fr.plugin.j7843.sso.auth</id>
<name><![CDATA[数据处理jsd7843]]></name>
<active>yes</active>
<version>1.1</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>mqh</vendor>
<description><![CDATA[数据处理jsd7843]]></description>
<change-notes><![CDATA[数据处理jsd7843]]></change-notes>
<main-package>com.fr.plugin.j7843.sso</main-package>
<prefer-packages>
<prefer-package>com.fanruan.api</prefer-package>
</prefer-packages>
<lifecycle-monitor class="com.fr.plugin.j7843.sso.LifeCycleMonitorImpl"/>
<extra-core>
<LocaleFinder class="com.fr.plugin.j7843.sso.LocaleFinder"/>
<DBAccessProvider class="com.fr.plugin.j7843.sso.ProcessDBAccess"/>
</extra-core>
<extra-decision>
<ControllerRegisterProvider class="com.fr.plugin.j7843.sso.request.ServiceControllerBridge"/>
</extra-decision>
<function-recorder class="com.fr.plugin.j7843.sso.LocaleFinder"/>
</plugin>

33
src/main/java/com/fr/plugin/j7843/sso/LifeCycleMonitorImpl.java

@ -0,0 +1,33 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: OneAccessLifeCycleMonitor
* Author: Louis
* Date: 2021/3/30 15:10
*/
package com.fr.plugin.j7843.sso;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor;
/**
* <Function Description><br>
* <LifeCycleMonitorImpl>
*
* @author Louis
* @since 1.0.0
*/
public class LifeCycleMonitorImpl extends AbstractPluginLifecycleMonitor {
public LifeCycleMonitorImpl() {
}
@Override
public void afterRun(PluginContext pluginContext) {
// SsoConfig.getInstance();
}
@Override
public void beforeStop(PluginContext pluginContext) {
}
}

37
src/main/java/com/fr/plugin/j7843/sso/LocaleFinder.java

@ -0,0 +1,37 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: LocaleFinder
* Author: Louis
* Date: 2020/8/31 22:19
*/
package com.fr.plugin.j7843.sso;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
import static com.fr.plugin.j7843.sso.config.SsoConfig.PLUGIN_ID;
/**
* <Function Description><br>
* <LocaleFinder>
*
* @author Louis
* @since 1.0.0
*/
@EnableMetrics
public class LocaleFinder extends AbstractLocaleFinder {
@Override
@Focus(id = PLUGIN_ID, text = "Plugin-J7843-Sso", source = Original.PLUGIN)
public String find() {
return "com/fr/plugin/j7843/sso/locale/lang";
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

66
src/main/java/com/fr/plugin/j7843/sso/ProcessDBAccess.java

@ -0,0 +1,66 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: RoleGroupDBAccess
* Author: Louis
* Date: 2020/6/4 11:48
*/
package com.fr.plugin.j7843.sso;
import com.fr.plugin.db.AbstractDBAccessProvider;
import com.fr.plugin.j7843.sso.dao.CstDataDao;
import com.fr.plugin.j7843.sso.dao.CstStatusDao;
import com.fr.plugin.j7843.sso.entity.CstDataEntity;
import com.fr.plugin.j7843.sso.entity.CstStatusEntity;
import com.fr.stable.db.accessor.DBAccessor;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.dao.DAOProvider;
/**
* Function Description<br>
* ProcessDBAccess
*
* @author Louis
* @since 1.0.0
*/
public class ProcessDBAccess extends AbstractDBAccessProvider {
private static DBAccessor accessor;
public ProcessDBAccess() {
}
public static DBAccessor getAccessor() {
return accessor;
}
@Override
public DAOProvider[] registerDAO() {
return new DAOProvider[]{
new DAOProvider() {
@Override
public Class getEntityClass() {
return CstDataEntity.class;
}
@Override
public Class<? extends BaseDAO> getDAOClass() {
return CstDataDao.class;
}
},
new DAOProvider() {
@Override
public Class getEntityClass() {
return CstStatusEntity.class;
}
@Override
public Class<? extends BaseDAO> getDAOClass() {
return CstStatusDao.class;
}
}
};
}
@Override
public void onDBAvailable(DBAccessor dbAccessor) {
accessor = dbAccessor;
}
}

128
src/main/java/com/fr/plugin/j7843/sso/bean/CstDataBean.java

@ -0,0 +1,128 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: CstBean
* Author: Louis
* Date: 2021/5/17 22:01
*/
package com.fr.plugin.j7843.sso.bean;
import com.fr.third.fasterxml.jackson.annotation.JsonInclude;
import com.fr.third.fasterxml.jackson.annotation.JsonProperty;
/**
* <Function Description><br>
* <CstDataBean>
*
* @author Louis
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class CstDataBean {
private String id;
private String pcode;
private String cityCo;
private String projName;
private String telphone;
private String time;
@JsonProperty("fy_code")
private String fyCode;
@JsonProperty("fy_name")
private String fyName;
private int price;
@JsonProperty("rg_time")
private String rgTime;
@JsonProperty("qy_time")
private String qyTime;
public CstDataBean() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPcode() {
return pcode;
}
public void setPcode(String pcode) {
this.pcode = pcode;
}
public String getTelphone() {
return telphone;
}
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getProjName() {
return projName;
}
public void setProjName(String projName) {
this.projName = projName;
}
public String getCityCo() {
return cityCo;
}
public void setCityCo(String cityCo) {
this.cityCo = cityCo;
}
public String getFyCode() {
return fyCode;
}
public void setFyCode(String fyCode) {
this.fyCode = fyCode;
}
public String getFyName() {
return fyName;
}
public void setFyName(String fyName) {
this.fyName = fyName;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getRgTime() {
return rgTime;
}
public void setRgTime(String rgTime) {
this.rgTime = rgTime;
}
public String getQyTime() {
return qyTime;
}
public void setQyTime(String qyTime) {
this.qyTime = qyTime;
}
}

104
src/main/java/com/fr/plugin/j7843/sso/bean/DataResponse.java

@ -0,0 +1,104 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: DataResponse
* Author: Louis
* Date: 2021/3/19 11:46
*/
package com.fr.plugin.j7843.sso.bean;
import com.fr.third.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
/**
* <Function Description><br>
* <DataResponse>
*
* @author Louis
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class DataResponse implements Serializable {
private static final long serialVersionUID = -6470353731188369521L;
private String code;
private String message;
private List<CstDataBean> data;
public DataResponse() {
}
public DataResponse code(String code) {
this.code = code;
return this;
}
public DataResponse message(String message) {
this.message = message;
return this;
}
public DataResponse data(List<CstDataBean> data) {
this.setData(data);
return this;
}
private static DataResponse create() {
return new DataResponse();
}
/**
* 操作结果
*
* @return
*/
public static DataResponse success() {
return create().code("0").message("success");
}
/**
* 操作结果
*
* @param data
* @return
*/
public static DataResponse operation(List<CstDataBean> data) {
return create().code("0").message("success").data(data);
}
/**
* 报错结果
*
* @param code
* @param message
* @return
*/
public static DataResponse error(String code, String message) {
return create().code(code).message(message);
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<CstDataBean> getData() {
return data;
}
public void setData(List<CstDataBean> data) {
this.data = data;
}
}

57
src/main/java/com/fr/plugin/j7843/sso/config/SsoConfig.java

@ -0,0 +1,57 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: OneAccessConfig
* Author: Louis
* Date: 2021/3/30 9:38
*/
package com.fr.plugin.j7843.sso.config;
import com.fr.config.ConfigContext;
import com.fr.config.DefaultConfiguration;
import com.fr.config.Visualization;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
/**
* <Function Description><br>
* <SsoConfig>
*
* @author Louis
* @since 1.0.0
*/
@Visualization(category = "Plugin-J7843-Sso_Group")
public class SsoConfig extends DefaultConfiguration {
public static final String PLUGIN_ID = "com.fr.plugin.j7843.sso.auth";
private static volatile SsoConfig config = null;
@Focus(id = PLUGIN_ID, text = "Plugin-J7843-Sso", source = Original.PLUGIN)
public static SsoConfig getInstance() {
if (config == null) {
config = ConfigContext.getConfigInstance(SsoConfig.class);
}
return config;
}
// @Identifier(value = "uriBase", name = "Plugin-J7843-Sso_Config_uriBase", description = "Plugin-J7843-Sso_Config_uriBase_Description", status = Status.SHOW)
// private Conf<String> uriBase = Holders.simple(StringKit.EMPTY);
// @Identifier(value = "privateKey", name = "Plugin-J7843-Sso_Config_privateKey", description = "Plugin-J7843-Sso_Config_privateKey_Description", status = Status.SHOW)
// private Conf<String> privateKey = Holders.simple(StringKit.EMPTY);
// public String getUriBase() {
// return uriBase.get();
// }
//
// public void setUriBase(String uriBase) {
// this.uriBase.set(uriBase);
// }
//
// public String getPrivateKey() {
// return privateKey.get();
// }
//
// public void setPrivateKey(String privateKey) {
// this.privateKey.set(privateKey);
// }
}

49
src/main/java/com/fr/plugin/j7843/sso/dao/CstDataDao.java

@ -0,0 +1,49 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: RoleGroupDAO
* Author: Louis
* Date: 2020/6/4 11:44
*/
package com.fr.plugin.j7843.sso.dao;
import com.fr.plugin.j7843.sso.ProcessDBAccess;
import com.fr.plugin.j7843.sso.entity.CstDataEntity;
import com.fr.stable.db.action.DBAction;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
/**
* Function Description<br>
* CstDataDao
*
* @author Louis
* @since 1.0.0
*/
public class CstDataDao extends BaseDAO<CstDataEntity> {
public CstDataDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<CstDataEntity> getEntityClass() {
return CstDataEntity.class;
}
/**
* Save
*
* @param saveCstData
* @throws Exception
*/
public static void save(final CstDataEntity saveCstData) throws Exception {
CstDataEntity cstDataEntity = ProcessDBAccess.getAccessor().runQueryAction(daoContext -> daoContext.getDAO(CstDataDao.class)
.getById(saveCstData.getId()));
if (cstDataEntity != null) {
return;
}
ProcessDBAccess.getAccessor().runDMLAction((DBAction<CstDataEntity>) daoContext -> {
(daoContext.getDAO(CstDataDao.class)).add(saveCstData);
return null;
});
}
}

46
src/main/java/com/fr/plugin/j7843/sso/dao/CstStatusDao.java

@ -0,0 +1,46 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: RoleGroupMiddleDao
* Author: Louis
* Date: 2020/6/4 14:33
*/
package com.fr.plugin.j7843.sso.dao;
import com.fr.plugin.j7843.sso.ProcessDBAccess;
import com.fr.plugin.j7843.sso.entity.CstStatusEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
import com.fr.stable.query.QueryFactory;
import com.fr.stable.query.restriction.RestrictionFactory;
import java.util.List;
/**
* Function Description<br>
* CstStatusDao
*
* @author Louis
* @since 1.0.0
*/
public class CstStatusDao extends BaseDAO<CstStatusEntity> {
public CstStatusDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<CstStatusEntity> getEntityClass() {
return CstStatusEntity.class;
}
/**
* 按照手机号查询状态
*
* @param telphone
* @throws Exception
*/
public static List<CstStatusEntity> getStatus(final String pcode, final String telphone) throws Exception {
return ProcessDBAccess.getAccessor().runQueryAction(daoContext -> daoContext.getDAO(CstStatusDao.class)
.find(QueryFactory.create().addRestriction(RestrictionFactory.eq(CstStatusEntity.COLUMN_TELPHONE, telphone))
.addRestriction(RestrictionFactory.eq(CstStatusEntity.COLUMN_P_CODE, pcode))
));
}
}

143
src/main/java/com/fr/plugin/j7843/sso/entity/CstDataEntity.java

@ -0,0 +1,143 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: RoleGroupEntity
* Author: Louis
* Date: 2020/6/3 16:18
*/
package com.fr.plugin.j7843.sso.entity;
import com.fanruan.api.util.StringKit;
import com.fr.plugin.j7843.sso.bean.CstDataBean;
import com.fr.stable.db.entity.BaseEntity;
import com.fr.third.javax.persistence.Column;
import com.fr.third.javax.persistence.Entity;
import com.fr.third.javax.persistence.Table;
/**
* Function Description<br>
* CstDataEntity
*
* @author Louis
* @since 1.0.0
*/
@Entity
@Table(name = "fine_cst_data")
public class CstDataEntity extends BaseEntity {
public static final String COLUMN_P_CODE = "pcode";
public static final String COLUMN_NAME = "name";
public static final String COLUMN_TELPHONE = "telphone";
public static final String COLUMN_TIME = "time";
public static final String COLUMN_PROJ_NAME = "projName";
public static final String COLUMN_CITY_CO = "cityCo";
private static final long serialVersionUID = 6358871812172045109L;
@Column(name = COLUMN_P_CODE)
private String pcode = StringKit.EMPTY;
@Column(name = COLUMN_NAME)
private String name = StringKit.EMPTY;
@Column(name = COLUMN_TELPHONE)
private String telphone = StringKit.EMPTY;
@Column(name = COLUMN_TIME)
private String time = StringKit.EMPTY;
@Column(name = COLUMN_PROJ_NAME)
private String projName = StringKit.EMPTY;
@Column(name = COLUMN_CITY_CO)
private String cityCo = StringKit.EMPTY;
public CstDataEntity() {
}
public CstDataBean createBean(CstDataBean cstData) {
cstData.setId(this.getId());
cstData.setPcode(this.getPcode());
cstData.setTelphone(this.getTelphone());
cstData.setTime(this.getTime());
cstData.setProjName(this.getProjName());
cstData.setCityCo(this.getCityCo());
return cstData;
}
public CstDataEntity id(String id) {
this.setId(id);
return this;
}
public CstDataEntity pcode(String pcode) {
this.setPcode(pcode);
return this;
}
public CstDataEntity name(String name) {
this.setName(name);
return this;
}
public CstDataEntity telphone(String telphone) {
this.setTelphone(telphone);
return this;
}
public CstDataEntity time(String time) {
this.setTime(time);
return this;
}
public CstDataEntity projName(String projName) {
this.setProjName(projName);
return this;
}
public CstDataEntity cityCo(String cityCo) {
this.setCityCo(cityCo);
return this;
}
public String getPcode() {
return pcode;
}
public void setPcode(String pcode) {
this.pcode = pcode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelphone() {
return telphone;
}
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getProjName() {
return projName;
}
public void setProjName(String projName) {
this.projName = projName;
}
public String getCityCo() {
return cityCo;
}
public void setCityCo(String cityCo) {
this.cityCo = cityCo;
}
}

163
src/main/java/com/fr/plugin/j7843/sso/entity/CstStatusEntity.java

@ -0,0 +1,163 @@
/*
* Copyright (C), 2018-2020
* Project: starter
* FileName: RoleGroupMiddleEntity
* Author: Louis
* Date: 2020/6/4 14:14
*/
package com.fr.plugin.j7843.sso.entity;
import com.fanruan.api.util.AssistKit;
import com.fanruan.api.util.StringKit;
import com.fr.plugin.j7843.sso.bean.CstDataBean;
import com.fr.stable.db.entity.BaseEntity;
import com.fr.third.javax.persistence.Column;
import com.fr.third.javax.persistence.Entity;
import com.fr.third.javax.persistence.Table;
/**
* Function Description<br>
* CstStatusEntity
*
* @author Louis
* @since 1.0.0
*/
@Entity
@Table(name = "fine_cst_status")
public class CstStatusEntity extends BaseEntity {
public static final String COLUMN_P_CODE = "pcode";
public static final String COLUMN_FY_CODE = "fy_code";
public static final String COLUMN_FY_NAME = "fy_name";
public static final String COLUMN_PRICE = "price";
public static final String COLUMN_RG_TIME = "rg_time";
public static final String COLUMN_QY_TIME = "qy_time";
public static final String COLUMN_TELPHONE = "telphone";
private static final long serialVersionUID = -7548354093125191283L;
@Column(name = COLUMN_P_CODE)
private String pcode = StringKit.EMPTY;
@Column(name = COLUMN_FY_CODE)
private String fyCode = StringKit.EMPTY;
@Column(name = COLUMN_FY_NAME)
private String fyName = StringKit.EMPTY;
@Column(name = COLUMN_PRICE)
private int price;
@Column(name = COLUMN_RG_TIME)
private String rgTime = StringKit.EMPTY;
@Column(name = COLUMN_QY_TIME)
private String qyTime = StringKit.EMPTY;
@Column(name = COLUMN_TELPHONE)
private String telphone = StringKit.EMPTY;
public CstStatusEntity() {
}
public void createBean(CstDataBean cstDataBean) {
cstDataBean.setFyCode(this.getFyCode());
cstDataBean.setFyName(this.getFyName());
cstDataBean.setPrice(this.getPrice());
cstDataBean.setRgTime(this.getRgTime());
cstDataBean.setQyTime(this.getQyTime());
}
public CstStatusEntity id(String id){
this.setId(id);
return this;
}
public CstStatusEntity pcode(String pcode) {
this.setPcode(pcode);
return this;
}
public CstStatusEntity fyCode(String fyCode) {
this.setFyCode(fyCode);
return this;
}
public CstStatusEntity fyName(String fyName) {
this.setFyName(fyName);
return this;
}
public CstStatusEntity price(int price) {
this.setPrice(price);
return this;
}
public CstStatusEntity rgTime(String rgTime) {
this.setRgTime(rgTime);
return this;
}
public CstStatusEntity qyTime(String qyTime) {
this.setQyTime(qyTime);
return this;
}
public CstStatusEntity telphone(String telphone){
this.setTelphone(telphone);
return this;
}
public String getTelphone() {
return telphone;
}
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getPcode() {
return pcode;
}
public void setPcode(String pcode) {
this.pcode = pcode;
}
public String getFyCode() {
return fyCode;
}
public void setFyCode(String fyCode) {
this.fyCode = fyCode;
}
public String getFyName() {
return fyName;
}
public void setFyName(String fyName) {
this.fyName = fyName;
}
public String getRgTime() {
return rgTime;
}
public void setRgTime(String rgTime) {
this.rgTime = rgTime;
}
public String getQyTime() {
return qyTime;
}
public void setQyTime(String qyTime) {
this.qyTime = qyTime;
}
@Override
public String toString() {
return AssistKit.toString(this);
}
}

112
src/main/java/com/fr/plugin/j7843/sso/request/ServiceController.java

@ -0,0 +1,112 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: CallBackController
* Author: Louis
* Date: 2021/3/29 22:36
*/
package com.fr.plugin.j7843.sso.request;
import com.fanruan.api.i18n.I18nKit;
import com.fanruan.api.log.LogKit;
import com.fr.decision.webservice.annotation.LoginStatusChecker;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.j7843.sso.bean.CstDataBean;
import com.fr.plugin.j7843.sso.bean.DataResponse;
import com.fr.plugin.j7843.sso.config.SsoConfig;
import com.fr.plugin.j7843.sso.dao.CstDataDao;
import com.fr.plugin.j7843.sso.dao.CstStatusDao;
import com.fr.plugin.j7843.sso.entity.CstDataEntity;
import com.fr.plugin.j7843.sso.entity.CstStatusEntity;
import com.fr.third.springframework.stereotype.Controller;
import com.fr.third.springframework.web.bind.annotation.RequestBody;
import com.fr.third.springframework.web.bind.annotation.RequestMapping;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.third.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import static com.fr.plugin.j7843.sso.entity.CstDataEntity.*;
/**
* <Function Description><br>
* <ServiceController>
*
* @author Louis
* @since 1.0.0
*/
@Controller
@RequestMapping("postCstData")
public class ServiceController {
private SsoConfig config;
public ServiceController() {
// this.config = SsoConfig.getInstance();
}
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
@LoginStatusChecker(required = false)
public DataResponse doAction(@RequestBody String paramBody, HttpServletRequest req, HttpServletResponse res) {
try {
setHeader(res);
JSONObject params = new JSONObject(paramBody);
return operation(params.getJSONArray("data"));
} catch (Exception e) {
LogKit.error(e.getMessage(), e);
}
return DataResponse.error("500", I18nKit.getLocText("Plugin-J7843-Sso_Error_500"));
}
/**
* 企业应用业务事件处理
*
* @param cstArray
* @return
*/
private DataResponse operation(JSONArray cstArray) throws Exception {
List<CstDataBean> result = new ArrayList<>();
List<CstStatusEntity> cstStatusList;
JSONObject cstObject;
CstDataBean cstDataBean;
for (int i = 0; i < cstArray.size(); i++) {
cstObject = cstArray.getJSONObject(i);
final CstDataEntity cstDataEntity = (new CstDataEntity()).id(cstObject.getString("id"))
.pcode(cstObject.getString(COLUMN_P_CODE))
.name(cstObject.getString(COLUMN_NAME))
.telphone(cstObject.getString(COLUMN_TELPHONE))
.time(cstObject.getString(COLUMN_TIME))
.projName(cstObject.getString(COLUMN_PROJ_NAME))
.cityCo(cstObject.getString(COLUMN_CITY_CO));
CstDataDao.save(cstDataEntity);
cstStatusList = CstStatusDao.getStatus(cstDataEntity.getPcode(), cstDataEntity.getTelphone());
for (CstStatusEntity cstStatusEntity : cstStatusList) {
if (cstStatusEntity != null) {
cstDataBean = new CstDataBean();
cstDataEntity.createBean(cstDataBean);
cstStatusEntity.createBean(cstDataBean);
result.add(cstDataBean);
}
}
}
return DataResponse.operation(result);
}
/**
* 解决跨域访问问题
*
* @param res
*/
private void setHeader(HttpServletResponse res) {
// 跨域设置header
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
res.setHeader("Access-Control-Max-Age", "3600");
res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
}
}

26
src/main/java/com/fr/plugin/j7843/sso/request/ServiceControllerBridge.java

@ -0,0 +1,26 @@
/*
* Copyright (C), 2018-2021
* Project: starter
* FileName: UserControllerBridge
* Author: Louis
* Date: 2021/3/29 22:30
*/
package com.fr.plugin.j7843.sso.request;
import com.fr.decision.fun.impl.AbstractControllerRegisterProvider;
/**
* <Function Description><br>
* <ServiceControllerBridge>
*
* @author Louis
* @since 1.0.0
*/
public class ServiceControllerBridge extends AbstractControllerRegisterProvider {
@Override
public Class[] getControllers() {
return new Class[]{
ServiceController.class
};
}
}

7
src/main/resources/com/fr/plugin/j7843/sso/locale/lang.properties

@ -0,0 +1,7 @@
Plugin-J7843-Sso=Sso Plugin
Plugin-J7843-Sso_Group=Sso Plugin
Plugin-J7843-Sso_Config_uriBase=BaseUri
Plugin-J7843-Sso_Config_uriBase_Description=BaseUri
Plugin-J7843-Sso_Config_privateKey=PrivateKey
Plugin-J7843-Sso_Config_privateKey_Description=PrivateKey
Plugin-J7843-Sso_Error_500=error

7
src/main/resources/com/fr/plugin/j7843/sso/locale/lang_zh_CN.properties

@ -0,0 +1,7 @@
Plugin-J7843-Sso=\u5355\u70B9\u767B\u9646\u63D2\u4EF6
Plugin-J7843-Sso_Group=\u5355\u70B9\u767B\u9646\u63D2\u4EF6
Plugin-J7843-Sso_Config_uriBase=\u63A5\u53E3\u5730\u5740
Plugin-J7843-Sso_Config_uriBase_Description=\u63A5\u53E3\u5730\u5740
Plugin-J7843-Sso_Config_privateKey=PrivateKey
Plugin-J7843-Sso_Config_privateKey_Description=PrivateKey
Plugin-J7843-Sso_Error_500=error
Loading…
Cancel
Save