Commit 42d37972 authored by suichenguang's avatar suichenguang

添加导入导出Excel

parents 74770c61 2df0cf1e
......@@ -37,6 +37,19 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring-boot-web-starter</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
This diff is collapsed.
package com.yxproject.start.api;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import com.yxproject.start.service.PersonPostAbnormalService;
import com.yxproject.start.service.PersonalProgressStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@RestController
@RequestMapping("api")
public class BizApi {
@Autowired
private PersonPostAbnormalService personPostAbnormalService;
@Autowired
private PersonalProgressStatusService personalProgressStatusService;
@RequestMapping("getErrorPostMsg")
public List<PersonPostAbnormalEntity> getErrorPostMsg(@RequestParam("date")String date, @RequestParam("police")String police) {
List<PersonPostAbnormalEntity> list = personPostAbnormalService.getPersonPostAbnormal(date,police);
return list;
}
@RequestMapping("getCardsPostMsg")
public List<CardsStatusAndPostMsgDto> getCardsPostMsg(@RequestParam("date")String date, @RequestParam("police")String police) {
List<CardsStatusAndPostMsgDto> list = personalProgressStatusService.getStatusAndPostMsg(date,police);
return list;
}
}
package com.yxproject.start.api;
import com.yxproject.start.entity.*;
import com.yxproject.start.mapper.*;
import com.yxproject.start.service.*;
import com.yxproject.start.utils.ReadExcel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
......@@ -17,17 +21,41 @@ import java.io.File;
@RestController
@RequestMapping("ReadExcel")
public class ReadExcelApi {
@Autowired
PersonalProgressStatusService personalProgressStatusService;
@Autowired
PersonPostAbnormalService personPostAbnormalService;
@Autowired
CardDetailedListService cardDetailedListService;
@Autowired
PersonPostService personPostService;
@Autowired
TemporaryCertificateService temporaryCertificateService;
@Autowired
RedoRegistrationService redoRegistrationService;
Boolean result = null;
/**
* 导入个人制证进度状态表
*/
@RequestMapping("ReadPPS")
public boolean ReadPersonalProgressStatus() throws Exception{
public boolean ReadPersonalProgressStatus() {
ReadExcel obj = new ReadExcel();
PersonalProgressStatusEntity personalProgressStatus = new PersonalProgressStatusEntity();
List<PersonalProgressStatusEntity> entityList=new ArrayList<PersonalProgressStatusEntity>();
File file = new File("E:/北京制证项目/personal_progress_status.xls");
List excelList = obj.readExcel(file);
for (int i = 0; i < excelList.size(); i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list ==null||i==0){
continue;
}
System.out.println("输出:"+list);
personalProgressStatus.setUploadNo((String) list.get(0));
personalProgressStatus.setProgressStatus((Long) list.get(1));
personalProgressStatus.setNote((String) list.get(2));
......@@ -41,24 +69,32 @@ public class ReadExcelApi {
personalProgressStatus.setOutStorageDate((Time) list.get(10));
personalProgressStatus.setHandOutDate((Time) list.get(11));
personalProgressStatus.setSignInDate((Time) list.get(12));
entityList.add(personalProgressStatus);
// for (int j=0;j<list.size();j++){
// System.out.println();
// }
result = personalProgressStatusService.updatePersonalProgressStatus(entityList);
}
return true;
return result;
}
/**
* 导入个人邮寄异常信息
*/
@RequestMapping("ReadPPA")
public boolean ReadPersonPostAbnormal()throws Exception{
public boolean ReadPersonPostAbnormal(){
ReadExcel obj = new ReadExcel();
PersonPostAbnormalEntity personPostAbnormal = new PersonPostAbnormalEntity();
List<PersonPostAbnormalEntity> entityList= new ArrayList<PersonPostAbnormalEntity>();
File file = new File("E:/北京制证项目/person_post_abnormal.xls");
List excelList = obj.readExcel(file);
for (int i = 0; i < excelList.size(); i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
personPostAbnormal.setBackWaybillNumber((String) list.get(0));
personPostAbnormal.setOrderNumber((String) list.get(1));
personPostAbnormal.setCreateDate((Time) list.get(2));
......@@ -83,41 +119,56 @@ public class ReadExcelApi {
personPostAbnormal.setNatureOfTheInformation((String) list.get(21));
personPostAbnormal.setFirstWhite((String) list.get(22));
personPostAbnormal.setErrCode((String) list.get(23));
entityList.add(personPostAbnormal);
System.out.println("111111111111111111"+entityList.get(0));
}
return true;
result = personPostAbnormalService.updatePersonPostAbnormal(entityList);
return result;
}
/**
* 导入身份证详单
*/
@RequestMapping("ReadCDL")
public boolean ReadCardDetailList()throws Exception{
public boolean ReadCardDetailList(){
ReadExcel obj = new ReadExcel();
CardDetailedListEntity cardDetailedList = new CardDetailedListEntity();
List<CardDetailedListEntity> entityList = new ArrayList<CardDetailedListEntity>();
File file = new File("E:/北京制证项目/Card_Detail_List.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
cardDetailedList.setPolistListId((String) list.get(0));
cardDetailedList.setUploadNo((String) list.get(1));
cardDetailedList.setNote((String) list.get(2));
cardDetailedList.setFileName((String) list.get(3));
cardDetailedList.setPoliceCode((String) list.get(4));
entityList.add(cardDetailedList);
}
return true;
result = cardDetailedListService.updateCardDetailedList(entityList);
return result;
}
/**
* 导入个人信息表
*/
@RequestMapping("ReadPersonPost")
public boolean ReadPersomPost()throws Exception{
public boolean ReadPersonPost(){
ReadExcel obj = new ReadExcel();
PersonPostEntity personPost = new PersonPostEntity();
List<PersonPostEntity> entityList = new ArrayList<PersonPostEntity>();
File file = new File("E:/北京制证项目/Person_Post.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
personPost.setBackWaybillNumber((String) list.get(0));
personPost.setOrderNumber((String) list.get(1));
personPost.setCreateDate((Time) list.get(2));
......@@ -141,21 +192,28 @@ public class ReadExcelApi {
personPost.setNatureOfTheInternal((String) list.get(20));
personPost.setLatticeMouthInformation((String) list.get(21));
personPost.setFirstWhite((String) list.get(22));
entityList.add(personPost);
}
return true;
result = personPostService.updatePersonPost(entityList);
return result;
}
/**
* 导入临时证信息
*/
@RequestMapping("ReadTemporaryCertificate")
public boolean ReadTemporaryCertificate()throws Exception{
public boolean ReadTemporaryCertificate(){
ReadExcel obj = new ReadExcel();
TemporaryCertificateEntity temporaryCertificate = new TemporaryCertificateEntity();
List<TemporaryCertificateEntity> entityList = new ArrayList<TemporaryCertificateEntity>();
File file = new File("E:/北京制证项目/Temporary_Certificate.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
temporaryCertificate.setName((String) list.get(0));
temporaryCertificate.setCardId((String) list.get(1));
temporaryCertificate.setPhone((String) list.get(2));
......@@ -165,20 +223,27 @@ public class ReadExcelApi {
temporaryCertificate.setBackWorkshopDate((String) list.get(6));
temporaryCertificate.setDeliverToParty((String) list.get(7));
temporaryCertificate.setNote((String) list.get(8));
entityList.add(temporaryCertificate);
}
return true;
result = temporaryCertificateService.updateTemporaryCertificate(entityList);
return result;
}
/**
* 导入重做证件信息
*/
@RequestMapping("ReadRedoRegistration")
public boolean ReadRedoRegistration()throws Exception{
public boolean ReadRedoRegistration(){
ReadExcel obj = new ReadExcel();
RedoRegistrationEntity redoRegistration = new RedoRegistrationEntity();
List<RedoRegistrationEntity> entityList = new ArrayList<RedoRegistrationEntity>();
File file = new File("E:/北京制证项目/Read_Redo_Registration.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
redoRegistration.setRedoRegistrationId((String) list.get(0));
redoRegistration.setSubmitDate((String) list.get(1));
redoRegistration.setCountyCode((String) list.get(2));
......@@ -189,8 +254,10 @@ public class ReadExcelApi {
redoRegistration.setCallDate((String) list.get(7));
redoRegistration.setBackDate((String) list.get(8));
redoRegistration.setNote((String) list.get(9));
entityList.add(redoRegistration);
}
return true;
result=redoRegistrationService.updateRedoRegistration(entityList);
return result;
}
......
package com.yxproject.start.api;
import com.yxproject.start.entity.UserInfo;
import net.sf.json.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* @author Administrator
*/
@RestController
@RequestMapping("user")
public class UserApi {
@PostMapping("login")
public Map<String, Object> submitLogin(@RequestBody String jsonStr) {
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
String username = jsonObject.getString("username");
String password = jsonObject.getString("password");
Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
Subject currentUser = SecurityUtils.getSubject();
// 把用户名和密码封装为 UsernamePasswordToken 对象
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
currentUser.login(token);
UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
resultMap.put("status", 200);
resultMap.put("message", "登录成功");
resultMap.put("user", userInfo);
} catch (UnknownAccountException e) {
resultMap.put("status", 201);
resultMap.put("message", "账号不存在!");
} catch (IncorrectCredentialsException e1) {
resultMap.put("status", 202);
resultMap.put("message", "密码错误!");
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", "用户名密码错误");
}
return resultMap;
}
@RequestMapping("logout")
public void logout() {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated()) {
subject.logout();
}
}
}
package com.yxproject.start.config;
import com.yxproject.start.entity.SysPermission;
import com.yxproject.start.entity.SysRole;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.service.UserInfoService;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Administrator
*/
public class MyShiroRealm extends AuthorizingRealm {
@Autowired
private UserInfoService userInfoService;
//告诉shiro如何根据获取到的用户信息中的密码和盐值来校验密码
{
//设置用于匹配密码的CredentialsMatcher
HashedCredentialsMatcher hashMatcher = new HashedCredentialsMatcher();
hashMatcher.setHashAlgorithmName("md5");
hashMatcher.setHashIterations(1024);
this.setCredentialsMatcher(hashMatcher);
}
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()");
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
UserInfo userInfo = (UserInfo) principals.getPrimaryPrincipal();
for (SysRole role : userInfo.getRoleList()) {
authorizationInfo.addRole(role.getRole());
for (SysPermission p : role.getPermissions()) {
authorizationInfo.addStringPermission(p.getPermission());
}
}
return authorizationInfo;
}
/**
* @param token
* @return
* @throws AuthenticationException
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
throws AuthenticationException {
System.out.println("MyShiroRealm.doGetAuthenticationInfo()");
//获取用户的输入的账号.
String username = (String) token.getPrincipal();
System.out.println(username);
System.out.println(token.getCredentials().toString());
//通过username从数据库中查找 User对象,如果找到,没找到.
//实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
UserInfo user = userInfoService.findByUsername(username);
if (user == null || user.getState() == 1) {
return null;
}
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
user,
user.getPassword(),
ByteSource.Util.bytes(user.getSalt()),
getName()
);
return authenticationInfo;
}
}
\ No newline at end of file
package com.yxproject.start.config;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Administrator
*/
@Configuration
public class ShiroConfig {
@Autowired
private MyShiroRealm realm;
@Bean
public MyShiroRealm customRealm() {
return new MyShiroRealm();
}
@Bean
public DefaultWebSecurityManager securityManager() {
System.out.println("添加了DefaultWebSecurityManager");
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(realm);
return securityManager;
}
@Bean
public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setUsePrefix(true);
return defaultAdvisorAutoProxyCreator;
}
@Bean
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
System.out.println("添加了过滤器链");
DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
chainDefinition.addPathDefinition("/admin/**", "authc");
chainDefinition.addPathDefinition("/admin/**", "roles[admin]");
chainDefinition.addPathDefinition("/user/login", "anon");
chainDefinition.addPathDefinition("/user/logout", "anon");
chainDefinition.addPathDefinition("/user/**", "authc");
chainDefinition.addPathDefinition("/**", "anon");
return chainDefinition;
}
}
package com.yxproject.start.dto;
import java.sql.Time;
/**
* @author Administrator
*/
public class CardsStatusAndPostMsgDto {
private String uploadNo;
private Long progressStatus;
private String note;
private String importDate;
private Time createTaskDate;
private Time dataCheckDate;
private Time filmPrintDate;
private Time positionDate;
private Time sortDate;
private Time qualityTestDate;
private Time outStorageDate;
private Time handOutDate;
private Time signInDate;
private String waybillNumber;
private String backWaybillNumber;
private String orderNumber;
private Time createDate;
private String openid;
private String wcPlayOrderNumber;
private String playState;
private String orderState;
private String applicantName;
private String senderName;
private String senderPhone;
private String senderAddress;
private String recipientName;
private String recipientPhone;
private String recipientAddress;
private String orderBlankNumber;
private String getToProvince;
private String getToCity;
private String getToCounty;
private String businessType;
private String latticeMouthInformation;
private String natureOfTheInternal;
private String natureOfTheInformation;
private String firstWhite;
public String getUploadNo() {
return uploadNo;
}
public void setUploadNo(String uploadNo) {
this.uploadNo = uploadNo;
}
public Long getProgressStatus() {
return progressStatus;
}
public void setProgressStatus(Long progressStatus) {
this.progressStatus = progressStatus;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getImportDate() {
return importDate;
}
public void setImportDate(String importDate) {
this.importDate = importDate;
}
public Time getCreateTaskDate() {
return createTaskDate;
}
public void setCreateTaskDate(Time createTaskDate) {
this.createTaskDate = createTaskDate;
}
public Time getDataCheckDate() {
return dataCheckDate;
}
public void setDataCheckDate(Time dataCheckDate) {
this.dataCheckDate = dataCheckDate;
}
public Time getFilmPrintDate() {
return filmPrintDate;
}
public void setFilmPrintDate(Time filmPrintDate) {
this.filmPrintDate = filmPrintDate;
}
public Time getPositionDate() {
return positionDate;
}
public void setPositionDate(Time positionDate) {
this.positionDate = positionDate;
}
public Time getSortDate() {
return sortDate;
}
public void setSortDate(Time sortDate) {
this.sortDate = sortDate;
}
public Time getQualityTestDate() {
return qualityTestDate;
}
public void setQualityTestDate(Time qualityTestDate) {
this.qualityTestDate = qualityTestDate;
}
public Time getOutStorageDate() {
return outStorageDate;
}
public void setOutStorageDate(Time outStorageDate) {
this.outStorageDate = outStorageDate;
}
public Time getHandOutDate() {
return handOutDate;
}
public void setHandOutDate(Time handOutDate) {
this.handOutDate = handOutDate;
}
public Time getSignInDate() {
return signInDate;
}
public void setSignInDate(Time signInDate) {
this.signInDate = signInDate;
}
public String getWaybillNumber() {
return waybillNumber;
}
public void setWaybillNumber(String waybillNumber) {
this.waybillNumber = waybillNumber;
}
public String getBackWaybillNumber() {
return backWaybillNumber;
}
public void setBackWaybillNumber(String backWaybillNumber) {
this.backWaybillNumber = backWaybillNumber;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Time getCreateDate() {
return createDate;
}
public void setCreateDate(Time createDate) {
this.createDate = createDate;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getWcPlayOrderNumber() {
return wcPlayOrderNumber;
}
public void setWcPlayOrderNumber(String wcPlayOrderNumber) {
this.wcPlayOrderNumber = wcPlayOrderNumber;
}
public String getPlayState() {
return playState;
}
public void setPlayState(String playState) {
this.playState = playState;
}
public String getOrderState() {
return orderState;
}
public void setOrderState(String orderState) {
this.orderState = orderState;
}
public String getApplicantName() {
return applicantName;
}
public void setApplicantName(String applicantName) {
this.applicantName = applicantName;
}
public String getSenderName() {
return senderName;
}
public void setSenderName(String senderName) {
this.senderName = senderName;
}
public String getSenderPhone() {
return senderPhone;
}
public void setSenderPhone(String senderPhone) {
this.senderPhone = senderPhone;
}
public String getSenderAddress() {
return senderAddress;
}
public void setSenderAddress(String senderAddress) {
this.senderAddress = senderAddress;
}
public String getRecipientName() {
return recipientName;
}
public void setRecipientName(String recipientName) {
this.recipientName = recipientName;
}
public String getRecipientPhone() {
return recipientPhone;
}
public void setRecipientPhone(String recipientPhone) {
this.recipientPhone = recipientPhone;
}
public String getRecipientAddress() {
return recipientAddress;
}
public void setRecipientAddress(String recipientAddress) {
this.recipientAddress = recipientAddress;
}
public String getOrderBlankNumber() {
return orderBlankNumber;
}
public void setOrderBlankNumber(String orderBlankNumber) {
this.orderBlankNumber = orderBlankNumber;
}
public String getGetToProvince() {
return getToProvince;
}
public void setGetToProvince(String getToProvince) {
this.getToProvince = getToProvince;
}
public String getGetToCity() {
return getToCity;
}
public void setGetToCity(String getToCity) {
this.getToCity = getToCity;
}
public String getGetToCounty() {
return getToCounty;
}
public void setGetToCounty(String getToCounty) {
this.getToCounty = getToCounty;
}
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
public String getLatticeMouthInformation() {
return latticeMouthInformation;
}
public void setLatticeMouthInformation(String latticeMouthInformation) {
this.latticeMouthInformation = latticeMouthInformation;
}
public String getNatureOfTheInternal() {
return natureOfTheInternal;
}
public void setNatureOfTheInternal(String natureOfTheInternal) {
this.natureOfTheInternal = natureOfTheInternal;
}
public String getNatureOfTheInformation() {
return natureOfTheInformation;
}
public void setNatureOfTheInformation(String natureOfTheInformation) {
this.natureOfTheInformation = natureOfTheInformation;
}
public String getFirstWhite() {
return firstWhite;
}
public void setFirstWhite(String firstWhite) {
this.firstWhite = firstWhite;
}
}
package com.yxproject.start.entity;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "COUNTY_DIC", schema = "POST", catalog = "")
......@@ -55,15 +54,24 @@ public class CountyDicEntity {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CountyDicEntity that = (CountyDicEntity) o;
return Objects.equals(countyCode, that.countyCode) &&
Objects.equals(countyname, that.countyname) &&
Objects.equals(administrativeCode, that.administrativeCode) &&
Objects.equals(yingxin, that.yingxin);
if (countyCode != null ? !countyCode.equals(that.countyCode) : that.countyCode != null) return false;
if (countyname != null ? !countyname.equals(that.countyname) : that.countyname != null) return false;
if (administrativeCode != null ? !administrativeCode.equals(that.administrativeCode) : that.administrativeCode != null)
return false;
if (yingxin != null ? !yingxin.equals(that.yingxin) : that.yingxin != null) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hash(countyCode, countyname, administrativeCode, yingxin);
int result = countyCode != null ? countyCode.hashCode() : 0;
result = 31 * result + (countyname != null ? countyname.hashCode() : 0);
result = 31 * result + (administrativeCode != null ? administrativeCode.hashCode() : 0);
result = 31 * result + (yingxin != null ? yingxin.hashCode() : 0);
return result;
}
}
......@@ -2,7 +2,6 @@ package com.yxproject.start.entity;
import javax.persistence.*;
import java.sql.Time;
import java.util.Objects;
@Entity
@Table(name = "PERSONAL_PROGRESS_STATUS", schema = "POST", catalog = "")
......@@ -155,24 +154,47 @@ public class PersonalProgressStatusEntity {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersonalProgressStatusEntity that = (PersonalProgressStatusEntity) o;
return Objects.equals(uploadNo, that.uploadNo) &&
Objects.equals(progressStatus, that.progressStatus) &&
Objects.equals(note, that.note) &&
Objects.equals(importDate, that.importDate) &&
Objects.equals(createTaskDate, that.createTaskDate) &&
Objects.equals(dataCheckDate, that.dataCheckDate) &&
Objects.equals(filmPrintDate, that.filmPrintDate) &&
Objects.equals(positionDate, that.positionDate) &&
Objects.equals(sortDate, that.sortDate) &&
Objects.equals(qualityTestDate, that.qualityTestDate) &&
Objects.equals(outStorageDate, that.outStorageDate) &&
Objects.equals(handOutDate, that.handOutDate) &&
Objects.equals(signInDate, that.signInDate);
if (uploadNo != null ? !uploadNo.equals(that.uploadNo) : that.uploadNo != null) return false;
if (progressStatus != null ? !progressStatus.equals(that.progressStatus) : that.progressStatus != null)
return false;
if (note != null ? !note.equals(that.note) : that.note != null) return false;
if (importDate != null ? !importDate.equals(that.importDate) : that.importDate != null) return false;
if (createTaskDate != null ? !createTaskDate.equals(that.createTaskDate) : that.createTaskDate != null)
return false;
if (dataCheckDate != null ? !dataCheckDate.equals(that.dataCheckDate) : that.dataCheckDate != null)
return false;
if (filmPrintDate != null ? !filmPrintDate.equals(that.filmPrintDate) : that.filmPrintDate != null)
return false;
if (positionDate != null ? !positionDate.equals(that.positionDate) : that.positionDate != null) return false;
if (sortDate != null ? !sortDate.equals(that.sortDate) : that.sortDate != null) return false;
if (qualityTestDate != null ? !qualityTestDate.equals(that.qualityTestDate) : that.qualityTestDate != null)
return false;
if (outStorageDate != null ? !outStorageDate.equals(that.outStorageDate) : that.outStorageDate != null)
return false;
if (handOutDate != null ? !handOutDate.equals(that.handOutDate) : that.handOutDate != null) return false;
if (signInDate != null ? !signInDate.equals(that.signInDate) : that.signInDate != null) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hash(uploadNo, progressStatus, note, importDate, createTaskDate, dataCheckDate, filmPrintDate, positionDate, sortDate, qualityTestDate, outStorageDate, handOutDate, signInDate);
int result = uploadNo != null ? uploadNo.hashCode() : 0;
result = 31 * result + (progressStatus != null ? progressStatus.hashCode() : 0);
result = 31 * result + (note != null ? note.hashCode() : 0);
result = 31 * result + (importDate != null ? importDate.hashCode() : 0);
result = 31 * result + (createTaskDate != null ? createTaskDate.hashCode() : 0);
result = 31 * result + (dataCheckDate != null ? dataCheckDate.hashCode() : 0);
result = 31 * result + (filmPrintDate != null ? filmPrintDate.hashCode() : 0);
result = 31 * result + (positionDate != null ? positionDate.hashCode() : 0);
result = 31 * result + (sortDate != null ? sortDate.hashCode() : 0);
result = 31 * result + (qualityTestDate != null ? qualityTestDate.hashCode() : 0);
result = 31 * result + (outStorageDate != null ? outStorageDate.hashCode() : 0);
result = 31 * result + (handOutDate != null ? handOutDate.hashCode() : 0);
result = 31 * result + (signInDate != null ? signInDate.hashCode() : 0);
return result;
}
}
package com.yxproject.start.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* @author liboyang
*/
@Entity
@Table(name="SYS_PERMISSION")
public class SysPermission implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
/**
* 主键.
*/
private Integer id;
/**
* 名称.
*/
private String name;
/**
* 资源类型
*/
private String resource_type;
/**
* 资源路径.
*/
private String url;
/**
* 权限字符串,menu例子:role:*,button例子:role:create,role:update,role:delete,role:view
*/
private String permission;
/**
* 父编号
*/
private Long parent_id;
/**
* 父编号列表
*/
private String parent_ids;
private byte available = 0;
@ManyToMany
@JoinTable(name="SysRolePermission",joinColumns={@JoinColumn(name="permissionId")},inverseJoinColumns={@JoinColumn(name="roleId")})
private List<SysRole> roles;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getResource_type() {
return resource_type;
}
public void setResource_type(String resource_type) {
this.resource_type = resource_type;
}
public String getParent_ids() {
return parent_ids;
}
public void setParent_ids(String parent_ids) {
this.parent_ids = parent_ids;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public Long getParent_id() {
return parent_id;
}
public void setParent_id(Long parent_id) {
this.parent_id = parent_id;
}
public byte getAvailable() {
return available;
}
public void setAvailable(byte available) {
this.available = available;
}
public List<SysRole> getRoles() {
return roles;
}
public void setRoles(List<SysRole> roles) {
this.roles = roles;
}
}
\ No newline at end of file
package com.yxproject.start.entity;
import javax.persistence.*;
import java.util.List;
/**
* @author liboyang
*/
@Entity
@Table(name="SYS_ROLE")
public class SysRole {
@Id
@GeneratedValue
/**
* 编号
*/
private Integer id;
/**
* 角色标识程序中判断使用,如"admin",这个是唯一的:
*/
private String role;
/**
* 角色描述,UI界面显示使用
*/
private String description;
/**
* 是否可用,如果不可用将不会添加给用户
*/
private byte available = 0;
/**
* 角色 -- 权限关系:多对多关系;
*/
@ManyToMany(fetch= FetchType.EAGER)
@JoinTable(name="SysRolePermission",joinColumns={@JoinColumn(name="roleId")},inverseJoinColumns={@JoinColumn(name="permissionId")})
private List<SysPermission> permissions;
/**
* 用户 - 角色关系定义;
*/
@ManyToMany
@JoinTable(name="SysUserRole",joinColumns={@JoinColumn(name="roleId")},inverseJoinColumns={@JoinColumn(name="userId")})
/**
* 一个角色对应多个用户
*/
private List<UserInfo> userInfos;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public byte getAvailable() {
return available;
}
public void setAvailable(byte available) {
this.available = available;
}
public List<SysPermission> getPermissions() {
return permissions;
}
public void setPermissions(List<SysPermission> permissions) {
this.permissions = permissions;
}
public List<UserInfo> getUserInfos() {
return userInfos;
}
public void setUserInfos(List<UserInfo> userInfos) {
this.userInfos = userInfos;
}
}
\ No newline at end of file
package com.yxproject.start.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* @author liboyang
*/
@Entity
@Table(name="USER_INFO")
public class UserInfo implements Serializable {
@Id
@GeneratedValue
private Integer id;
@Column(unique =true)
private String username;
private String name;
private String password;
private String salt;
private byte state;
@ManyToMany(fetch= FetchType.EAGER)
@JoinTable(name = "SysUserRole", joinColumns = { @JoinColumn(name = "userId") }, inverseJoinColumns ={@JoinColumn(name = "roleId") })
private List<SysRole> roleList;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public byte getState() {
return state;
}
public void setState(byte state) {
this.state = state;
}
public List<SysRole> getRoleList() {
return roleList;
}
public void setRoleList(List<SysRole> roleList) {
this.roleList = roleList;
}
}
\ No newline at end of file
package com.yxproject.start.mapper;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* @author Administrator
*/
@Mapper
public interface PersonPostAbnormalMapper {
/**
* 查询某个派出所某天的有错误的邮寄信息
* @param date
* @param police
* @return
*/
@Select("select * from PERSON_POST_ABNORMAL where FIRST_WHITE in (select UPLOAD_NO from CARD_DETAILED_LIST where POLICE_CODE=#{police} and UPLOAD_NO like CONCAT(CONCAT('%',#{date}),'%'))")
public List<PersonPostAbnormalEntity> selectPersonPostAbnormalMsg(@Param("police")String police,@Param("date")String date);
@Update("update PERSON_POST_ABNORMAL set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},,APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite},ERR_CODE=#{errCode}")
public void updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormal);
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormal);
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.entity.PersonPostEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List;
......@@ -10,6 +10,14 @@ import java.util.List;
@Mapper
public interface PersonPostMapper {
/**
* 查询证件状态和邮寄详情
* @param police
* @param date
* @return
*/
public List<PersonPostEntity> selectPersonPostMsg(@Param("police")String police, @Param("date")String date);
@Update("update PERSON_POST set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=,#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite}")
public void updatePersonPost(List<PersonPostEntity> personPost);
......
package com.yxproject.start.mapper;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.*;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@Mapper
public interface PersonalProgressStatusMapper {
/**
* 查询证件状态和邮寄详情
* @param police
* @param date
* @return
*/
@Select("SELECT * FROM PERSONAL_PROGRESS_STATUS a LEFT JOIN PERSON_POST b ON a.UPLOAD_NO = b.FIRST_WHITE WHERE substr(a.UPLOAD_NO,0,9) = #{police} AND a.UPLOAD_NO LIKE CONCAT(CONCAT('%',#{date}),'%')")
public List<CardsStatusAndPostMsgDto> selectStatusAndPostMsg(@Param("date")String date, @Param("police")String police);
@Update("update PERSONAL_PROGRESS_STATUS set UPLOAD_NO =#{uploadNo},PROGRESS_STATUS=#{progressStatus},NOTE=#{note},IMPORT_DATE=#{importDate},CREATE_TASK_DATE=#{create_Task_Date},DATA_CHECK_DATE=#{data_Check_Date},FILM_PRINT_DATE=#{film_Print_Date},POSITION_DATE=#{position_Date},SORT_DATE=#{sort_Date},QUALITY_TEST_DATE=#{quality_Test_Date},OUT_STORAGE_DATE=#{out_Storage_Date},HAND_OUT_DATE=#{hand_Out_Date},SIGN_IN_DATE=#{sign_In_Date}")
public void updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatus);
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.SysPermission;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@Mapper
public interface SysPermissionMapper{
/**
* 新增权限
* @param sysPermission
*/
@Insert("INSERT INTO sys_permission (id,available,name,parent_id,parent_ids,permission,resource_type,url)\n" +
"VALUES (PERMISSION_seq.nextval,0,#{name},'0','0/',#{permission},#{resource_type},#{url})")
public void addPermissionByMap(SysPermission sysPermission);
/**
* 查询所有可用权限
* @return
*/
@Select("select * from SYS_PERMISSION where available=0")
public List<SysPermission> selectAllActivePermission();
/**
* 查询所有权限
* @return
*/
@Select("select * from SYS_PERMISSION")
public List<SysPermission> selectAllPermission();
/**
* 删除权限
* @param permissionId
*/
@Update("UPDATE SYS_PERMISSION SET AVAILABLE = 1 WHERE ID=#{permissionId}")
public void delPermission(@Param("permissionId") Integer permissionId);
/**
* 启用权限
* @param permissionId
*/
@Update("UPDATE SYS_PERMISSION SET AVAILABLE = 0 WHERE ID=#{permissionId}")
public void backPermission(@Param("permissionId") Integer permissionId);
/**
* 通过角色id查询权限
* @param roleId
* @return
*/
@Select("select * from SYS_ROLE_PERMISSION srp ,SYS_PERMISSION sp where srp.PERMISSION_ID=sp.ID and srp.ROLE_ID=#{roleId}")
public List<SysPermission> selectPermissionByRoleId(@Param("roleId") Integer roleId);
/**
*通过id查询权限信息
* @param permissionId
* @return
*/
@Select("select * from SYS_PERMISSION WHERE ID=#{permissionId}")
public SysPermission selectPermissionByPid(@Param("permissionId") Integer permissionId);
/**
* 通过父id查询父名称
* @param parentId
* @return
*/
@Select("select name from SYS_PERMISSION WHERE ID=#{parentId}")
public String selectParentNameById(@Param("parentId") Long parentId);
/**
* 修改权限信息
* @param sysPermission
*/
@Update("update SYS_PERMISSION SET NAME=#{name},resource_type=#{resource_type},url=#{url}," +
"permission=#{permission} where id=#{id}")
public void updatePermission(SysPermission sysPermission);
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.SysRole;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author liboyang
*/
@Mapper
public interface SysRoleMapper {
/**
* 添加角色
* @param sysRole
*/
@Insert("INSERT INTO SYS_ROLE(ID,AVAILABLE,DESCRIPTION,ROLE)\n" +
"VALUES(PERMISSION_seq.nextval,0,#{description},#{role})")
@Options(useGeneratedKeys = true, keyProperty = "id",keyColumn = "id")
public void addRoleByMap(SysRole sysRole);
/**
* 添加角色和权限
* @param roleId
* @param permissionId
*/
@Insert("INSERT INTO SYS_ROLE_PERMISSION(ROLE_ID,PERMISSION_ID)VALUES(#{roleId},#{permissionId})")
public void addRolePermission(@Param("roleId") Integer roleId, @Param("permissionId") Integer permissionId);
/**
* 查询所有角色
* @return
*/
@Select("select * from SYS_ROLE")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
public List<SysRole> selectAllRole();
/**
* 查询所有可用角色
* @return
*/
@Select("select * from SYS_ROLE WHERE AVAILABLE=0")
public List<SysRole> selectAllActiveRole();
/**
* 通过用户id查询角色
* @param userId
* @return
*/
@Select("select sr.id,sr.role from SYS_USER_ROLE sur ,SYS_ROLE sr where sur.ROLE_ID=sr.ID and sur.USER_ID=#{userId}")
List<SysRole> selectRoleByUserId(@Param("userId") Integer userId);
/**
* 通过用户id查询角色
* @param userId
* @return
*/
@Select("select * from SYS_USER_ROLE sur ,SYS_ROLE sr where sur.ROLE_ID=sr.ID and sur.USER_ID=#{userId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
List<SysRole> selectRoleAndPermissionByUserId(@Param("userId") Integer userId);
/**
* 更新用户的角色
* @param userId
* @param roleId
*/
@Update("update SYS_USER_ROLE SET ROLE_ID=#{roleId} where USER_ID=#{userId}")
public void updateUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
/**
* 删除角色
* @param roleId
*/
@Update("UPDATE SYS_ROLE SET AVAILABLE = 1 WHERE ID=#{roleId}")
public void delRole(@Param("roleId") Integer roleId);
/**
* 启用角色
* @param roleId
*/
@Update("UPDATE SYS_ROLE SET AVAILABLE = 0 WHERE ID=#{roleId}")
public void backRole(@Param("roleId") Integer roleId);
/**
* 通过角色id查角色和权限
* @param roleId
* @return
*/
@Select("select * from SYS_ROLE where id=#{roleId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "role",column = "role"),
@Result(property = "description",column = "description"),
@Result(property = "available",column = "available"),
@Result(property = "permissions",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysPermissionMapper.selectPermissionByRoleId"))})
public SysRole selectRoleByRoleId(@Param("roleId") Integer roleId);
/**
* 修改角色信息
* @param sysRole
*/
@Update("update SYS_ROLE set role=#{role},description=#{description} where id=#{id}")
public void updateSysRole(SysRole sysRole);
/**
* 删除角色权限关系表中旧关系
* @param roleId
* @param oldPermissionId
*/
@Delete("delete from SYS_ROLE_PERMISSION WHERE ROLE_ID=#{roleId} AND PERMISSION_ID=#{oldPermissionId}")
public void delRolePermission(@Param("roleId") Integer roleId, @Param("oldPermissionId") Integer oldPermissionId);
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.UserInfo;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @author liboyang
*/
@Mapper
public interface UserInfoMapper {
/**
* 通过用户名查询用户信息
* @param username
* @return
*/
@Select("select * from USER_INFO where username=#{username}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleAndPermissionByUserId"))})
public UserInfo findUserByUsername(String username);
/**
* 新增用户
* @param userinfo
* @return
*/
@Insert("INSERT INTO USER_INFO(ID, NAME, PASSWORD, STATE, USERNAME, SALT) " +
"VALUES(USER_INFO_seq.nextval,#{name},#{password},0,#{username},#{salt})\n")
@Options(useGeneratedKeys = true, keyProperty = "id",keyColumn = "id")
public void saveUserInfo(UserInfo userinfo);
/**
* 添加用户角色关系表
* @param userId
* @param roleId
*/
@Insert("INSERT INTO SYS_USER_ROLE(USER_ID,ROLE_ID)VALUES(#{userId},#{roleId})\n")
public void saveUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
/**
* 查询所有用户
* @return
*/
@Select("select * from USER_INFO")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleAndPermissionByUserId"))})
public List<UserInfo> selectAllUserInfo();
/**
* 通过id查询用户
* @param userId
* @return
*/
@Select("select * from USER_INFO WHERE id=#{userId}")
@Results({@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "name",column = "name"),
@Result(property = "password",column = "password"),
@Result(property = "salt",column = "salt"),
@Result(property = "state",column = "state"),
@Result(property = "roleList",javaType = List.class,column ="id",
many = @Many(select = "com.yxproject.start.mapper.SysRoleMapper.selectRoleByUserId"))})
public UserInfo selectUserInfoByUserId(@Param("userId") Integer userId);
/**
* 删除用户
* @param userId
*/
@Update("UPDATE USER_INFO SET STATE = 1 WHERE ID=#{userId}")
public void delUserInfo(@Param("userId") Integer userId);
/**
* 启用用户
* @param userId
*/
@Update("UPDATE USER_INFO SET STATE = 0 WHERE ID=#{userId}")
public void backUserInfo(@Param("userId") Integer userId);
/**
* 更新用户
* @param userInfo
*/
@Update("UPDATE USER_INFO SET USERNAME=#{username},NAME=#{name} where ID=#{id}")
public void updateUserInfo(UserInfo userInfo);
}
......@@ -7,5 +7,6 @@ import java.util.List;
* 导入身份证详单
*/
public interface CardDetailedListService {
public boolean updateCardDetailedList(List<CardDetailedListEntity> cardDetailedListEntities);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 导入个人邮寄异常信息
* @author Administrator
*/
@Component
public interface PersonPostAbnormalService {
/**
* 查询某个派出所某天的有错误的邮寄信息
* @param date
* @param police
* @return
*/
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police);
/**
* 导入个人邮寄异常信息
*/
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities);
}
package com.yxproject.start.service;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import java.util.List;
import java.util.Map;
/**
* 导入个人制证进度状态表
* @author Administrator
*/
public interface PersonalProgressStatusService {
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police);
/**
* 导入个人制证进度状态表
*/
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.SysPermission;
import java.util.List;
import java.util.Map;
public interface SysPermissionService {
/**
* 新增权限
* @param sysPermission
* @return
*/
public boolean addPermission(SysPermission sysPermission);
/**
* 查询所有权限
* @return
*/
public List<SysPermission> getAllPermission();
/**
* 查询所有可用权限
* @return
*/
public List<SysPermission> getAllActivePermission();
/**
* 删除权限
* @param permissionId
* @return
*/
public boolean deletePermission(Integer permissionId);
/**
* 启用权限
* @param permissionId
* @return
*/
public boolean backPermission(Integer permissionId);
/**
* 通过权限id查询权限
* @param permissionId
* @return
*/
public SysPermission getPermissionByPId(Integer permissionId);
/**
* 通过父id查询父名称
* @param parentId
* @return
*/
public String getParentNameByParentId(Long parentId);
/**
* 修改权限信息
* @param sysPermission
* @return
*/
public boolean updatePermission(SysPermission sysPermission);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.SysRole;
import net.sf.json.JSONArray;
import java.util.List;
/**
* @author liboyang
*/
public interface SysRoleService {
/**
* 添加角色并分配权限
* @param sysRole
* @param jsonArray
* @return
*/
public boolean addRole(SysRole sysRole, JSONArray jsonArray);
/**
* 修改角色和权限
* @param sysRole
* @param ids
* @param oldIds
* @return
*/
public boolean updateRole(SysRole sysRole, JSONArray ids, JSONArray oldIds);
/**
* 查询所有角色
* @return
*/
public List<SysRole> getAllRoleInfo();
/**
* 查询所有可用的角色
* @return
*/
public List<SysRole> getAllActiveRoleInfo();
/**
* 删除角色
* @param roleId
* @return
*/
public boolean deleteRole(Integer roleId);
/**
* 启用角色
* @param roleId
* @return
*/
public boolean backRole(Integer roleId);
/**
* 通过角色id查询角色和权限
* @param roleId
* @return
*/
public SysRole getRoleByRoleId(Integer roleId);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.UserInfo;
import java.util.List;
/**
* @author liboyang
*/
public interface UserInfoService{
/**
* 查询用户
* @param username
* @return
*/
public UserInfo findByUsername(String username);
/**
* 新增用户
* @param userinfo
* @param roleId
* @return
*/
public boolean addUser(UserInfo userinfo, Integer roleId);
/**
* 查询所有用户
* @return
*/
public List<UserInfo> getAllUserInfo();
/**
* 删除用户
* @param userId
* @return
*/
public boolean deleteUserInfo(Integer userId);
/**
* 启用用户
* @param userId
* @return
*/
public boolean BackUserInfo(Integer userId);
/**
* 通过用户id查询用户和角色
* @param userId
* @return
*/
public UserInfo getUserInfoByUserId(Integer userId);
/**
* 更新用户
* @param userInfo
* @param roleId
* @return
*/
public boolean updateUser(UserInfo userInfo, Integer roleId, Integer oldRoleId);
// int delUsername( UserInfo userInfo);
// int updateUsername(UserInfo userInfo);
}
......@@ -4,9 +4,11 @@ import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.mapper.CardDetailedListMapper;
import com.yxproject.start.service.CardDetailedListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CardDetialedListServiceImpl implements CardDetailedListService {
@Autowired
......
......@@ -4,14 +4,23 @@ import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.mapper.PersonPostAbnormalMapper;
import com.yxproject.start.service.PersonPostAbnormalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class PersonPostAbnormalServiceImpl implements PersonPostAbnormalService {
@Autowired
private PersonPostAbnormalMapper personPostAbnormalMapper;
@Override
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police) {
List<PersonPostAbnormalEntity> list = personPostAbnormalMapper.selectPersonPostAbnormalMsg(police, date);
return list;
}
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities) {
personPostAbnormalMapper.updatePersonPostAbnormal(personPostAbnormalEntities);
return true;
......
......@@ -4,9 +4,11 @@ import com.yxproject.start.entity.PersonPostEntity;
import com.yxproject.start.mapper.PersonPostMapper;
import com.yxproject.start.service.PersonPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PersonPostServiceImpl implements PersonPostService {
@Autowired
......
package com.yxproject.start.service.impl;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import com.yxproject.start.mapper.PersonalProgressStatusMapper;
import com.yxproject.start.service.PersonalProgressStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@Service
public class PersonalProgressStatusServiceImpl implements PersonalProgressStatusService {
@Autowired
private PersonalProgressStatusMapper personalProgressStatusMapper;
@Override
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police) {
List<CardsStatusAndPostMsgDto> list = personalProgressStatusMapper.selectStatusAndPostMsg(date, police);
return list;
}
@Override
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities) {
personalProgressStatusMapper.updatePersonalProgressStatus(personalProgressStatusEntities);
......
......@@ -4,9 +4,11 @@ import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.mapper.RedoRegistrationMapper;
import com.yxproject.start.service.RedoRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RedoRegistrationServiceImpl implements RedoRegistrationService {
@Autowired
private RedoRegistrationMapper redoRegistrationMapper;
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.SysPermission;
import com.yxproject.start.mapper.SysPermissionMapper;
import com.yxproject.start.service.SysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class SysPermissionServiceImpl implements SysPermissionService{
@Autowired
private SysPermissionMapper sysPermissionMapper;
@Override
public boolean addPermission(SysPermission sysPermission) {
sysPermissionMapper.addPermissionByMap(sysPermission);
return true;
}
@Override
public List<SysPermission> getAllActivePermission() {
List<SysPermission> list = sysPermissionMapper.selectAllActivePermission();
return list;
}
@Override
public List<SysPermission> getAllPermission() {
List<SysPermission> list = sysPermissionMapper.selectAllPermission();
return list;
}
@Override
public boolean deletePermission(Integer permissionId) {
sysPermissionMapper.delPermission(permissionId);
return true;
}
@Override
public boolean backPermission(Integer permissionId) {
sysPermissionMapper.backPermission(permissionId);
return true;
}
@Override
public SysPermission getPermissionByPId(Integer permissionId) {
SysPermission sysPermission = sysPermissionMapper.selectPermissionByPid(permissionId);
return sysPermission;
}
@Override
public String getParentNameByParentId(Long parentId) {
String parentName = sysPermissionMapper.selectParentNameById(parentId);
return parentName;
}
@Override
public boolean updatePermission(SysPermission sysPermission) {
sysPermissionMapper.updatePermission(sysPermission);
return true;
}
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.SysRole;
import com.yxproject.start.mapper.SysRoleMapper;
import com.yxproject.start.service.SysRoleService;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author liboyang
*/
@Service
public class SysRoleServiceImpl implements SysRoleService {
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
@Transactional(rollbackFor=Exception.class)
public boolean addRole(SysRole sysRole, JSONArray jsonArray) {
sysRoleMapper.addRoleByMap(sysRole);
Integer roleId = sysRole.getId();
for (Object object:jsonArray){
sysRoleMapper.addRolePermission(roleId,Integer.parseInt(object.toString()));
}
return true;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean updateRole(SysRole sysRole, JSONArray ids, JSONArray oldIds) {
sysRoleMapper.updateSysRole(sysRole);
for (Object object:oldIds){
sysRoleMapper.delRolePermission(sysRole.getId(),Integer.parseInt(object.toString()));
}
for (Object object:ids){
sysRoleMapper.addRolePermission(sysRole.getId(),Integer.parseInt(object.toString()));
}
return true;
}
@Override
public List<SysRole> getAllRoleInfo() {
List<SysRole> list = sysRoleMapper.selectAllRole();
return list;
}
@Override
public List<SysRole> getAllActiveRoleInfo() {
List<SysRole> list = sysRoleMapper.selectAllActiveRole();
return list;
}
@Override
public boolean deleteRole(Integer roleId) {
sysRoleMapper.delRole(roleId);
return true;
}
@Override
public boolean backRole(Integer roleId) {
sysRoleMapper.backRole(roleId);
return true;
}
@Override
public SysRole getRoleByRoleId(Integer roleId) {
SysRole sysRole = sysRoleMapper.selectRoleByRoleId(roleId);
return sysRole;
}
}
......@@ -4,9 +4,11 @@ import com.yxproject.start.entity.TemporaryCertificateEntity;
import com.yxproject.start.mapper.TemporaryCertificateMapper;
import com.yxproject.start.service.TemporaryCertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TemporaryCertificateServiceImpl implements TemporaryCertificateService {
@Autowired
private TemporaryCertificateMapper temporaryCertificateMapper;
......
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.UserInfo;
import com.yxproject.start.mapper.SysRoleMapper;
import com.yxproject.start.mapper.UserInfoMapper;
import com.yxproject.start.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author liboyang
*/
@Service
public class UserInfoServiceImpl implements UserInfoService {
@Autowired
private UserInfoMapper userInfoMapper;
@Autowired
private SysRoleMapper sysRoleMapper;
@Override
public UserInfo findByUsername(String username) {
UserInfo user = userInfoMapper.findUserByUsername(username);
return user;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean addUser(UserInfo userinfo, Integer roleId) {
userInfoMapper.saveUserInfo(userinfo);
if(roleId==-1){
return true;
}
userInfoMapper.saveUserRole(userinfo.getId(),roleId);
return true;
}
@Override
public List<UserInfo> getAllUserInfo() {
List<UserInfo> list = userInfoMapper.selectAllUserInfo();
return list;
}
@Override
public boolean deleteUserInfo(Integer userId) {
userInfoMapper.delUserInfo(userId);
return true;
}
@Override
public boolean BackUserInfo(Integer userId) {
userInfoMapper.backUserInfo(userId);
return true;
}
@Override
public UserInfo getUserInfoByUserId(Integer userId) {
UserInfo userInfo = userInfoMapper.selectUserInfoByUserId(userId);
return userInfo;
}
@Override
@Transactional(rollbackFor=Exception.class)
public boolean updateUser(UserInfo userInfo, Integer roleId, Integer oldRoleId) {
userInfoMapper.updateUserInfo(userInfo);
if(roleId.equals(oldRoleId)){
return true;
}
sysRoleMapper.updateUserRole(userInfo.getId(),roleId);
return true;
}
}
package com.yxproject.start.utils;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.UUID;
/**
* 工具类
* @author itdragon
*
*/
public class Md5Utils {
private static final String ALGORITHM_NAME = "MD5";
private static final Integer HASH_ITERATIONS = 1024;
/**
* 加盐加密的策略非常多,根据实际业务来
*/
public static String entryptPassword(String password,String salt) {
Object md5Password = new SimpleHash(ALGORITHM_NAME, password, ByteSource.Util.bytes(salt), HASH_ITERATIONS);
return md5Password.toString();
}
public static String getCurrentDateTime() {
TimeZone zone = TimeZone.getTimeZone("Asia/Beijing");
TimeZone.setDefault(zone);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(new Date());
}
public static void main(String[] args){
String salt = UUID.randomUUID().toString();
String pass = Md5Utils.entryptPassword("123456",salt);
System.out.println(pass);
System.out.println(salt);
}
}
......@@ -8,5 +8,9 @@ spring:
username: post
password: post
mybatis:
type-aliases-package: com.yxproject.start.entity
#加载Mybatis配置文件
mapper-locations: classpath:mapper/*Mapper.xml
config-location: classpath:mapper/config/mybatis-config.xml
____ ____ __ .__ __. _______ ___ ___ __ .__ __.
\ \ / / | | | \ | | / _____|\ \ / / | | | \ | |
\ \/ / | | | \| | | | __ \ V / | | | \| |
\_ _/ | | | . ` | | | |_ | > < | | | . ` |
| | | | | |\ | | |__| | / . \ | | | |\ |
|__| |__| |__| \__| \______| /__/ \__\ |__| |__| \__|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment