Browse Source

更新

master
liwenkai 1 year ago
parent
commit
8e9b2e0318
174 changed files with 3095 additions and 3262 deletions
  1. +1
    -1
      lib/CNG信息.txt
  2. +102
    -104
      src/main/java/com/ciotea/cdcng/front/application/carPremises/CarInfoController.java
  3. +1
    -1
      src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/BindBottleController.java
  4. +94
    -99
      src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/ChecklogController.java
  5. +0
    -3
      src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/PrintBottcertController.java
  6. +38
    -39
      src/main/java/com/ciotea/cdcng/front/application/system/SystemController.java
  7. +2
    -2
      src/main/java/com/ciotea/cdcng/front/domain/carPremises/makeQRCode/service/MakeQRCodeServiceImpl.java
  8. +9
    -6
      src/main/java/com/ciotea/cdcng/front/domain/entity/system/User.java
  9. +2
    -1
      src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/bottle/repository/AirBottleRepositoryImpl.java
  10. +2
    -2
      src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/bottle/service/AirBottleServiceImpl.java
  11. +1
    -1
      src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/refittingCar/entity/CngCdCar.java
  12. +489
    -493
      src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/refittingCar/repository/CngCdCarStrategyImpl.java
  13. +2
    -0
      src/main/java/com/ciotea/cdcng/front/domain/repository/system/UserRepository.java
  14. +5
    -0
      src/main/java/com/ciotea/cdcng/front/domain/repository/system/impl/UserRepositoryImpl.java
  15. +11
    -11
      src/main/java/com/ciotea/cdcng/front/domain/service/system/UserService.java
  16. +36
    -26
      src/main/java/com/ciotea/cdcng/front/domain/service/system/impl/UserServiceImpl.java
  17. +2
    -2
      src/main/java/com/ciotea/cdcng/front/domain/specialInspection/allquery/service/impl/BottgropfcServiceImpl.java
  18. +3
    -1
      src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checklog/service/ChecklogService.java
  19. +201
    -254
      src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checklog/service/impl/ChecklogServiceImpl.java
  20. +1
    -1
      src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checkmanage/service/impl/BindBottleServiceImpl.java
  21. +2
    -2
      src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checkmanage/service/impl/BottleAddServiceImpl.java
  22. +10
    -2
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/password/PasswordEncoder.java
  23. +15
    -46
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/userdetails/UserDetailsService.java
  24. +1
    -21
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/AuthenticationFailureHandler.java
  25. +2
    -19
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/AuthenticationSuccessHandler.java
  26. +1
    -0
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/MyLogoutSuccessHandler.java
  27. +2
    -1
      src/main/resources/mybatis/yunsa/car/carMapper.xml
  28. +2
    -4
      src/main/resources/spring/ctx-mvc.xml
  29. +2
    -8
      src/main/resources/spring/ctx-security.xml
  30. BIN
      src/main/webapp/WEB-INF/lib/activation-1.1.jar
  31. BIN
      src/main/webapp/WEB-INF/lib/activemq-client-5.10.0.jar
  32. BIN
      src/main/webapp/WEB-INF/lib/activemq-jms-pool-5.10.0.jar
  33. BIN
      src/main/webapp/WEB-INF/lib/activemq-pool-5.10.0.jar
  34. BIN
      src/main/webapp/WEB-INF/lib/ant-1.8.2.jar
  35. BIN
      src/main/webapp/WEB-INF/lib/ant-launcher-1.8.2.jar
  36. BIN
      src/main/webapp/WEB-INF/lib/antlr-2.7.7.jar
  37. BIN
      src/main/webapp/WEB-INF/lib/aopalliance-1.0.jar
  38. BIN
      src/main/webapp/WEB-INF/lib/app-infrastructure-0.0.1-SNAPSHOT.jar
  39. BIN
      src/main/webapp/WEB-INF/lib/asm-3.3.1.jar
  40. BIN
      src/main/webapp/WEB-INF/lib/aspectjweaver-1.8.2.jar
  41. BIN
      src/main/webapp/WEB-INF/lib/bcmail-jdk15-1.45.jar
  42. BIN
      src/main/webapp/WEB-INF/lib/bcprov-jdk15-1.45.jar
  43. BIN
      src/main/webapp/WEB-INF/lib/c3p0-0.9.1.1.jar
  44. BIN
      src/main/webapp/WEB-INF/lib/classmate-1.0.0.jar
  45. BIN
      src/main/webapp/WEB-INF/lib/commons-beanutils-1.8.3.jar
  46. BIN
      src/main/webapp/WEB-INF/lib/commons-codec-1.10.jar
  47. BIN
      src/main/webapp/WEB-INF/lib/commons-collections-3.2.1.jar
  48. BIN
      src/main/webapp/WEB-INF/lib/commons-csv-1.0.jar
  49. BIN
      src/main/webapp/WEB-INF/lib/commons-digester-1.8.jar
  50. BIN
      src/main/webapp/WEB-INF/lib/commons-fileupload-1.5.jar
  51. BIN
      src/main/webapp/WEB-INF/lib/commons-io-2.2.jar
  52. BIN
      src/main/webapp/WEB-INF/lib/commons-lang3-3.3.2.jar
  53. BIN
      src/main/webapp/WEB-INF/lib/commons-net-3.3.jar
  54. BIN
      src/main/webapp/WEB-INF/lib/commons-pool-1.6.jar
  55. BIN
      src/main/webapp/WEB-INF/lib/commons-pool2-2.0.jar
  56. BIN
      src/main/webapp/WEB-INF/lib/commons-validator-1.4.0.jar
  57. BIN
      src/main/webapp/WEB-INF/lib/cxf-api-2.7.4.jar
  58. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-bindings-soap-2.7.4.jar
  59. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-bindings-xml-2.7.4.jar
  60. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-core-2.7.4.jar
  61. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-databinding-jaxb-2.7.4.jar
  62. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-frontend-jaxws-2.7.4.jar
  63. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-frontend-simple-2.7.4.jar
  64. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-transports-http-2.7.4.jar
  65. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-transports-http-jetty-2.7.4.jar
  66. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-ws-addr-2.7.4.jar
  67. BIN
      src/main/webapp/WEB-INF/lib/cxf-rt-ws-policy-2.7.4.jar
  68. BIN
      src/main/webapp/WEB-INF/lib/dom4j-1.6.1.jar
  69. BIN
      src/main/webapp/WEB-INF/lib/fastjson-1.2.47.jar
  70. BIN
      src/main/webapp/WEB-INF/lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar
  71. BIN
      src/main/webapp/WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar
  72. BIN
      src/main/webapp/WEB-INF/lib/geronimo-jms_1.1_spec-1.1.1.jar
  73. BIN
      src/main/webapp/WEB-INF/lib/geronimo-jta_1.0.1B_spec-1.0.1.jar
  74. BIN
      src/main/webapp/WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar
  75. BIN
      src/main/webapp/WEB-INF/lib/hamcrest-core-1.1.jar
  76. BIN
      src/main/webapp/WEB-INF/lib/hawtbuf-1.10.jar
  77. BIN
      src/main/webapp/WEB-INF/lib/hibernate-commons-annotations-4.0.5.Final.jar
  78. BIN
      src/main/webapp/WEB-INF/lib/hibernate-core-4.3.7.Final.jar
  79. BIN
      src/main/webapp/WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar
  80. BIN
      src/main/webapp/WEB-INF/lib/hibernate-validator-5.2.0.Beta1.jar
  81. BIN
      src/main/webapp/WEB-INF/lib/iTrusCertAPI-2.7.9.jar
  82. BIN
      src/main/webapp/WEB-INF/lib/jackson-annotations-2.4.0.jar
  83. BIN
      src/main/webapp/WEB-INF/lib/jackson-core-2.4.3.jar
  84. BIN
      src/main/webapp/WEB-INF/lib/jackson-core-asl-1.9.13.jar
  85. BIN
      src/main/webapp/WEB-INF/lib/jackson-databind-2.4.3.jar
  86. BIN
      src/main/webapp/WEB-INF/lib/jackson-mapper-asl-1.9.13.jar
  87. BIN
      src/main/webapp/WEB-INF/lib/jandex-1.1.0.Final.jar
  88. BIN
      src/main/webapp/WEB-INF/lib/javassist-3.18.1-GA.jar
  89. BIN
      src/main/webapp/WEB-INF/lib/javax.el-api-3.0.1-b04.jar
  90. BIN
      src/main/webapp/WEB-INF/lib/javax.servlet-api-3.1.0.jar
  91. BIN
      src/main/webapp/WEB-INF/lib/jaxb-impl-2.1.13.jar
  92. BIN
      src/main/webapp/WEB-INF/lib/jboss-logging-3.1.3.GA.jar
  93. BIN
      src/main/webapp/WEB-INF/lib/jboss-logging-annotations-1.2.0.Beta1.jar
  94. BIN
      src/main/webapp/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar
  95. BIN
      src/main/webapp/WEB-INF/lib/jedis-2.6.0.jar
  96. BIN
      src/main/webapp/WEB-INF/lib/jetty-continuation-8.1.7.v20120910.jar
  97. BIN
      src/main/webapp/WEB-INF/lib/jetty-http-8.1.7.v20120910.jar
  98. BIN
      src/main/webapp/WEB-INF/lib/jetty-io-8.1.7.v20120910.jar
  99. BIN
      src/main/webapp/WEB-INF/lib/jetty-security-8.1.7.v20120910.jar
  100. BIN
      src/main/webapp/WEB-INF/lib/jetty-server-8.1.7.v20120910.jar

+ 1
- 1
lib/CNG信息.txt View File

@ -13,7 +13,7 @@
密码:cngcs2022! 密码:cngcs2022!
三、堡垒机信息: 三、堡垒机信息:
访问地址:https://172.23.252.220/web/main.ssi
访问地址:http://172.23.252.220
账号:CNGZH-user01 账号:CNGZH-user01
密码:CNGzh321!CNGzh321! 密码:CNGzh321!CNGzh321!

+ 102
- 104
src/main/java/com/ciotea/cdcng/front/application/carPremises/CarInfoController.java View File

@ -34,114 +34,112 @@ import infrastructure.support.records.Order;
/** /**
* 车辆信息查询 * 车辆信息查询
*
*/ */
@Controller @Controller
@RequestMapping(value = "carInfo") @RequestMapping(value = "carInfo")
public class CarInfoController { public class CarInfoController {
@Resource
Repository repository;
@Resource
CngCdCarStrategy carStrategy;
@Resource
AuthorityDepartmentRepository authorityDepartmentRepository;
@Resource
BottleRepository bottleRepository;
@Resource
DepartmentRepository departmentRepository;
@Resource
CngUserRepository cngUserRepository;
@Resource
AreaRepository areaRepository;
@Resource
BottleCertRepository bottleCertRepository;
@Resource
private LogOperation logOperation;
@ResponseBody
@RequestMapping(value = "carList", method = RequestMethod.GET)
infrastructure.support.records.Pagination getCars(CngCdCar vo, Context context, Integer dict, Integer dept, Integer area_dict, infrastructure.support.records.Pagination pagination) {
PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(),context.getDistrict());
List<Integer> list = departmentRepository.getLoginerDepartmentType(context);
if(context.getUser().getUsername().equals("cngpublic")){
pagination.setRows(carStrategy.publicUserCarInfo(vo.getPlatenum(), vo.getVin()));
}else{
pagination.setRows(carStrategy.getCngCdCar(vo, permissionFilter, pagination, dict, dept, area_dict));
}
return pagination;
}
@ResponseBody
@RequestMapping(value = "cngTypeDict", method = RequestMethod.GET)
List<CngTypeDict> getCngTypeDicts(Context context) {
List<CngTypeDict> list = new ArrayList<CngTypeDict>();
boolean cancel = false;
if( context.getDepartment().getDeptType() != null ){
if( context.getDepartment().getDeptType().getId()==24 ){//交委
cancel = true;
}
}
if(cancel){
list = carStrategy.getCancelList();
}else{
list = repository.getAll(CngTypeDict.class, Order.asc("id"));
}
return list;
}
@ResponseBody
@RequestMapping(value = "regDept", method = RequestMethod.GET)
List<AuthorityDepartment> getRegDepts() {
Integer types[] = new Integer[] { 17, 22 };
List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types);
return list;
}
@ResponseBody
@RequestMapping(value = "areaDict", method = RequestMethod.GET)
List<AreaDict> getAreaDicts() {
@Resource
Repository repository;
@Resource
CngCdCarStrategy carStrategy;
@Resource
AuthorityDepartmentRepository authorityDepartmentRepository;
@Resource
BottleRepository bottleRepository;
@Resource
DepartmentRepository departmentRepository;
@Resource
CngUserRepository cngUserRepository;
@Resource
AreaRepository areaRepository;
@Resource
BottleCertRepository bottleCertRepository;
@Resource
private LogOperation logOperation;
@ResponseBody
@RequestMapping(value = "carList", method = RequestMethod.GET)
infrastructure.support.records.Pagination getCars(CngCdCar vo, Context context, Integer dict, Integer dept, Integer area_dict, infrastructure.support.records.Pagination pagination) {
PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context.getDepartment(), context.getDistrict());
if (context.getUser().getUsername().equals("cngpublic")) {
pagination.setRows(carStrategy.publicUserCarInfo(vo.getPlatenum(), vo.getVin()));
} else {
pagination.setRows(carStrategy.getCngCdCar(vo, permissionFilter, pagination, dict, dept, area_dict));
}
return pagination;
}
@ResponseBody
@RequestMapping(value = "cngTypeDict", method = RequestMethod.GET)
List<CngTypeDict> getCngTypeDicts(Context context) {
List<CngTypeDict> list;
boolean cancel = false;
if (context.getDepartment().getDeptType() != null) {
if (context.getDepartment().getDeptType().getId() == 24) {//交委
cancel = true;
}
}
if (cancel) {
list = carStrategy.getCancelList();
} else {
list = repository.getAll(CngTypeDict.class, Order.asc("id"));
}
return list;
}
@ResponseBody
@RequestMapping(value = "regDept", method = RequestMethod.GET)
List<AuthorityDepartment> getRegDepts() {
Integer types[] = new Integer[]{17, 22};
List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types);
return list;
}
@ResponseBody
@RequestMapping(value = "areaDict", method = RequestMethod.GET)
List<AreaDict> getAreaDicts() {
// List<AreaDict> list = repository.getAll(AreaDict.class, Order.asc("id")); // List<AreaDict> list = repository.getAll(AreaDict.class, Order.asc("id"));
List<AreaDict> list = areaRepository.getAll();
return list;
}
@ResponseBody
@RequestMapping(value = "bottles", method = RequestMethod.GET)
List<Bottle> getBottles(Integer carId) {
List<Bottle> list = new ArrayList<Bottle>();
if(null != carId){
list = bottleRepository.getBottleByCarId(carId);
}
return list;
}
@ResponseBody
@RequestMapping(value = "getCarById", method = RequestMethod.GET)
CngCdCar getCar(Integer id) {
CngCdCar car = repository.get(CngCdCar.class, id);
return car;
}
@ResponseBody
@RequestMapping(value = "carState", method = RequestMethod.PUT)
void updateCarState(Integer id, Context context) {
BottleCert bottleCert = bottleCertRepository.getUseing(id);
if(bottleCert == null) {
throw new AppException("该车辆没有正在使用的气瓶使用登记证,请先绑定!");
} else {
CngCdCar car = repository.get(CngCdCar.class, id);
car.setCarState(4);
repository.save(car);
logOperation.saveCngcdCarLog(car, context.getUser().getUsername(), Operations.UPDATE, "气瓶使用登记证绑定模块中,修改车辆状态为已绑定气瓶使用登记证");
}
}
List<AreaDict> list = areaRepository.getAll();
return list;
}
@ResponseBody
@RequestMapping(value = "bottles", method = RequestMethod.GET)
List<Bottle> getBottles(Integer carId) {
List<Bottle> list = new ArrayList<Bottle>();
if (null != carId) {
list = bottleRepository.getBottleByCarId(carId);
}
return list;
}
@ResponseBody
@RequestMapping(value = "getCarById", method = RequestMethod.GET)
CngCdCar getCar(Integer id) {
CngCdCar car = repository.get(CngCdCar.class, id);
return car;
}
@ResponseBody
@RequestMapping(value = "carState", method = RequestMethod.PUT)
void updateCarState(Integer id, Context context) {
BottleCert bottleCert = bottleCertRepository.getUseing(id);
if (bottleCert == null) {
throw new AppException("该车辆没有正在使用的气瓶使用登记证,请先绑定!");
} else {
CngCdCar car = repository.get(CngCdCar.class, id);
car.setCarState(4);
repository.save(car);
logOperation.saveCngcdCarLog(car, context.getUser().getUsername(), Operations.UPDATE, "气瓶使用登记证绑定模块中,修改车辆状态为已绑定气瓶使用登记证");
}
}
} }

+ 1
- 1
src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/BindBottleController.java View File

@ -224,7 +224,7 @@ public class BindBottleController {
isLetterTo = true; isLetterTo = true;
} }
} }
// 将号段按字母拆开后再组合
// TODO 截取气瓶使用登记证编号 将号段按字母拆开后再组合
String[] str = range.getRangeFrom().split(range.getRangeFrom().substring(numberFrom, numberFrom + 1)); String[] str = range.getRangeFrom().split(range.getRangeFrom().substring(numberFrom, numberFrom + 1));
String strFrom = ""; String strFrom = "";
for(int k = 0; k < str.length; k++){ for(int k = 0; k < str.length; k++){

+ 94
- 99
src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/ChecklogController.java View File

@ -57,9 +57,8 @@ import infrastructure.support.utils.StringUtil;
/** /**
* 定检管理 * 定检管理
*
* @author fuxj
* *
* @author fuxj
*/ */
@Controller @Controller
@RequestMapping(value = "checklog") @RequestMapping(value = "checklog")
@ -88,31 +87,30 @@ public class ChecklogController {
@Resource @Resource
BottgropfcService bottgropfcService; BottgropfcService bottgropfcService;
@Resource @Resource
AuthorityDepartmentRepository deptRepository; AuthorityDepartmentRepository deptRepository;
@Resource @Resource
BottleCertRepository bottleCertRepository; BottleCertRepository bottleCertRepository;
@Resource @Resource
AuthorityDepartmentRepository authorityDepartmentRepository; AuthorityDepartmentRepository authorityDepartmentRepository;
@Resource @Resource
RfidtagsendRepository rfidtagsendRepository; RfidtagsendRepository rfidtagsendRepository;
@Resource @Resource
private LogOperation logOperation; private LogOperation logOperation;
private static final String CHECKER_SELECTED = "checkerSelected"; private static final String CHECKER_SELECTED = "checkerSelected";
private static final String VERIFIER_SELECTED = "verifierSelected"; private static final String VERIFIER_SELECTED = "verifierSelected";
private static final String APPROVER_SELECTED = "approverSelected"; private static final String APPROVER_SELECTED = "approverSelected";
/** /**
*
* 获取列表 * 获取列表
*
*
* @param platenum * @param platenum
* @param vin * @param vin
* @param workingTypeDict * @param workingTypeDict
@ -125,30 +123,28 @@ public class ChecklogController {
@ResponseBody @ResponseBody
@RequestMapping(value = "bottlecert", method = RequestMethod.GET) @RequestMapping(value = "bottlecert", method = RequestMethod.GET)
infrastructure.support.records.Pagination getBottleCert(String platenum, String vin, infrastructure.support.records.Pagination getBottleCert(String platenum, String vin,
Integer workingTypeDict, String bottlecode, String owner,
Integer areaDict, infrastructure.support.records.Pagination pagination, Context context) {
Integer workingTypeDict, String bottlecode, String owner,
Integer areaDict, infrastructure.support.records.Pagination pagination, Context context) {
// PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context); // PermissionFilter permissionFilter = cngUserRepository.permissionFilter(context);
return pagination.setRows(bottleCertRepository.getBottleCert(platenum, return pagination.setRows(bottleCertRepository.getBottleCert(platenum,
vin, workingTypeDict, bottlecode, owner, areaDict, pagination, null)); vin, workingTypeDict, bottlecode, owner, areaDict, pagination, null));
} }
/** /**
*
* 根据ID获取气瓶使用登记证 * 根据ID获取气瓶使用登记证
*
*
* @param id * @param id
* @return * @return
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "cert", method = RequestMethod.GET) @RequestMapping(value = "cert", method = RequestMethod.GET)
BottleCert getCarById(Integer id) { BottleCert getCarById(Integer id) {
return repository.get(BottleCert.class, id);
return repository.get(BottleCert.class, id);
} }
/** /**
*
* 获取区域 * 获取区域
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -159,7 +155,7 @@ public class ChecklogController {
/** /**
* 获取使用性质 * 获取使用性质
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -169,9 +165,8 @@ public class ChecklogController {
} }
/** /**
*
* 获取气瓶列表 * 获取气瓶列表
*
*
* @param platenum * @param platenum
* @return * @return
*/ */
@ -183,7 +178,7 @@ public class ChecklogController {
/** /**
* 得到所有的车辆类型 * 得到所有的车辆类型
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -220,8 +215,8 @@ public class ChecklogController {
} }
/** /**
* 获取检验审核批准人员
*
* 获取检验审核批准人员
*
* @param context * @param context
* @return * @return
*/ */
@ -231,25 +226,25 @@ public class ChecklogController {
List<CngUser> userlist = new ArrayList<CngUser>(); List<CngUser> userlist = new ArrayList<CngUser>();
List<Position> postlist = context.getDepartment().getPositions(); List<Position> postlist = context.getDepartment().getPositions();
for (Position position : postlist) {
if(position.getCode().equals("jyzzw")) {
Set<User> setuser = position.getUsers();
Iterator<User> it = setuser.iterator();
while(it.hasNext()) {
User user = it.next();
if(!StringUtil.isNullOrBlank(user.getSignature())) {
CngUser cnguser = cngUserRepository.findBySysUserId(user.getId());
userlist.add(cnguser);
}
for (Position position : postlist) {
if (position.getCode().equals("jyzzw")) {
Set<User> setuser = position.getUsers();
Iterator<User> it = setuser.iterator();
while (it.hasNext()) {
User user = it.next();
if (!StringUtil.isNullOrBlank(user.getSignature())) {
CngUser cnguser = cngUserRepository.findBySysUserId(user.getId());
userlist.add(cnguser);
} }
} }
} }
}
return userlist; return userlist;
} }
/** /**
* 获取判废标准 * 获取判废标准
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -259,9 +254,8 @@ public class ChecklogController {
} }
/** /**
*
* 定检合格 * 定检合格
*
*
* @param nextCheckDate * @param nextCheckDate
* @param bcodes * @param bcodes
* @param check * @param check
@ -270,15 +264,15 @@ public class ChecklogController {
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "passcheck", method = RequestMethod.POST) @RequestMapping(value = "passcheck", method = RequestMethod.POST)
CheckLog passCheckLog(String nextCheckDate, String[] bcodes,
CheckLog check, Context context) {
if(!StringUtil.isNullOrBlank(nextCheckDate)){
if(!Tool.isDate2(nextCheckDate)){
Map<String, Object> passCheckLog(String nextCheckDate, String[] bcodes,
CheckLog check, Context context) {
if (!StringUtil.isNullOrBlank(nextCheckDate)) {
if (!Tool.isDate2(nextCheckDate)) {
throw new AppException("请输入正确的日期格式,如2012-01-10"); throw new AppException("请输入正确的日期格式,如2012-01-10");
} }
} }
Department dment = context.getPosition().getDepartment(); Department dment = context.getPosition().getDepartment();
AuthorityDepartment dept = deptRepository.findByMemo(dment.getId()); AuthorityDepartment dept = deptRepository.findByMemo(dment.getId());
CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId());
@ -286,9 +280,8 @@ public class ChecklogController {
} }
/** /**
*
* 定检报废 * 定检报废
*
*
* @param bcodescrap * @param bcodescrap
* @param scrapmemo * @param scrapmemo
* @param check * @param check
@ -298,28 +291,30 @@ public class ChecklogController {
@ResponseBody @ResponseBody
@RequestMapping(value = "scarpcheck", method = RequestMethod.POST) @RequestMapping(value = "scarpcheck", method = RequestMethod.POST)
CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos, CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos,
CheckLog check, Context context) {
CheckLog check, Context context) {
Department dment = context.getPosition().getDepartment(); Department dment = context.getPosition().getDepartment();
AuthorityDepartment dept = deptRepository.findByMemo(dment.getId()); AuthorityDepartment dept = deptRepository.findByMemo(dment.getId());
CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId());
return checklogService.scrapCheckLog(bcodescraps, scrapmemos, check, return checklogService.scrapCheckLog(bcodescraps, scrapmemos, check,
user, dept); user, dept);
} }
int isres=0;
int isres = 0;
@ResponseBody @ResponseBody
@RequestMapping(value = "checkcount", method = RequestMethod.GET) @RequestMapping(value = "checkcount", method = RequestMethod.GET)
Integer getChecklogByCount(Integer carid) { Integer getChecklogByCount(Integer carid) {
List<CheckLog> list = checklogRepository.getChecklogByCount(carid); List<CheckLog> list = checklogRepository.getChecklogByCount(carid);
CngCdCar car = repository.get(CngCdCar.class, carid); CngCdCar car = repository.get(CngCdCar.class, carid);
if(list.size() > 0) {//表示有未打印数据
if (list.size() > 0) {//表示有未打印数据
isres = 1;//未打印 isres = 1;//未打印
}else{
if(car!=null){
if(car.getBottleNum() != null && car.getBottleNum() > 0) {
} else {
if (car != null) {
if (car.getBottleNum() != null && car.getBottleNum() > 0) {
isres = 2;//有气瓶 isres = 2;//有气瓶
} }
if(car.getBottleNum() == null || car.getBottleNum() <= 0){
if (car.getBottleNum() == null || car.getBottleNum() <= 0) {
isres = 3;//没有气瓶 isres = 3;//没有气瓶
} }
} }
@ -329,7 +324,7 @@ public class ChecklogController {
/** /**
* 车辆信息修改 * 车辆信息修改
*
*
* @param car * @param car
* @param context * @param context
* @return * @return
@ -345,7 +340,7 @@ public class ChecklogController {
/** /**
* 得到气瓶类型 * 得到气瓶类型
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -356,7 +351,7 @@ public class ChecklogController {
/** /**
* 得到生产厂家 * 得到生产厂家
*
*
* @return * @return
*/ */
@ResponseBody @ResponseBody
@ -367,7 +362,7 @@ public class ChecklogController {
/** /**
* 新增气瓶信息 * 新增气瓶信息
*
*
* @param bott * @param bott
* @param context * @param context
* @return * @return
@ -383,7 +378,7 @@ public class ChecklogController {
/** /**
* 修改气瓶信息 * 修改气瓶信息
*
*
* @param bott * @param bott
* @param context * @param context
* @return * @return
@ -398,11 +393,11 @@ public class ChecklogController {
bottle.setDateJoined(tempBottle.getDateJoined()); bottle.setDateJoined(tempBottle.getDateJoined());
return checklogService.updateBottle(bottle, user, dept); return checklogService.updateBottle(bottle, user, dept);
} }
/** /**
* 删除气瓶 * 删除气瓶
*
*
* @param bott * @param bott
* @param context * @param context
* @return * @return
@ -411,19 +406,19 @@ public class ChecklogController {
@RequestMapping(value = "bottle", method = RequestMethod.DELETE) @RequestMapping(value = "bottle", method = RequestMethod.DELETE)
void delBottle(Bottle bottle, Context context) { void delBottle(Bottle bottle, Context context) {
List<Bottle> list = bottleRepository.findBottleByCode(bottle.getBottCode()); List<Bottle> list = bottleRepository.findBottleByCode(bottle.getBottCode());
if(list != null && list.size() > 0) {
if (list != null && list.size() > 0) {
Bottle temp = list.get(0); Bottle temp = list.get(0);
if(temp.getBottState() != 1) {
if (temp.getBottState() != 1) {
throw new AppException("该气瓶还有标签,请注销/报废后重试"); throw new AppException("该气瓶还有标签,请注销/报废后重试");
} else { } else {
CngCdCar car = repository.get(CngCdCar.class, temp.getCar().getId()); CngCdCar car = repository.get(CngCdCar.class, temp.getCar().getId());
if(car == null) {
if (car == null) {
throw new AppException("没有找到所属车辆信息"); throw new AppException("没有找到所属车辆信息");
} else { } else {
Department sysdept = context.getPosition().getDepartment(); Department sysdept = context.getPosition().getDepartment();
AuthorityDepartment dept = deptRepository.findByMemo(sysdept.getId()); AuthorityDepartment dept = deptRepository.findByMemo(sysdept.getId());
CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId());
temp.setRowState(2); temp.setRowState(2);
temp.setTouchDeptId(dept.getId()); temp.setTouchDeptId(dept.getId());
temp.setTouchUserId(user.getId()); temp.setTouchUserId(user.getId());
@ -438,8 +433,8 @@ public class ChecklogController {
} }
/** /**
*
* 定检结果打印列表 * 定检结果打印列表
*
* @param platenum * @param platenum
* @param checkcode * @param checkcode
* @param starttime * @param starttime
@ -452,21 +447,22 @@ public class ChecklogController {
@ResponseBody @ResponseBody
@RequestMapping(value = "checklogs", method = RequestMethod.GET) @RequestMapping(value = "checklogs", method = RequestMethod.GET)
infrastructure.support.records.Pagination getChecklog(CheckLogView logview, String starttime, infrastructure.support.records.Pagination getChecklog(CheckLogView logview, String starttime,
String endtime, infrastructure.support.records.Pagination pagination, Context context) {
String endtime, infrastructure.support.records.Pagination pagination, Context context) {
// PermissionFilter permission = cngUserRepository.permissionFilter(context); // PermissionFilter permission = cngUserRepository.permissionFilter(context);
return pagination.setRows(checklogRepository.getChecklog(logview, starttime, endtime, pagination, null)); return pagination.setRows(checklogRepository.getChecklog(logview, starttime, endtime, pagination, null));
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "eualifed", method = RequestMethod.GET) @RequestMapping(value = "eualifed", method = RequestMethod.GET)
List<Eualifieddict> getEualifieddict() { List<Eualifieddict> getEualifieddict() {
return checklogRepository.getEualifieddict(); return checklogRepository.getEualifieddict();
} }
/** /**
* 当前登录用户单位编号 * 当前登录用户单位编号
*
* @param context * @param context
* @return
* @return5
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "deptcode", method = RequestMethod.GET) @RequestMapping(value = "deptcode", method = RequestMethod.GET)
@ -474,11 +470,10 @@ public class ChecklogController {
Department dment = context.getPosition().getDepartment(); Department dment = context.getPosition().getDepartment();
return deptRepository.findByMemo(dment.getId()); return deptRepository.findByMemo(dment.getId());
} }
/** /**
*
* 根据定检编号获取对象 * 根据定检编号获取对象
*
*
* @param checkCode * @param checkCode
* @return * @return
*/ */
@ -487,7 +482,7 @@ public class ChecklogController {
Map<String, Object> getCheckLogByCode(Integer checkid) { Map<String, Object> getCheckLogByCode(Integer checkid) {
return checklogRepository.getBottCert(checkid); return checklogRepository.getBottCert(checkid);
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "printlog", method = RequestMethod.PUT) @RequestMapping(value = "printlog", method = RequestMethod.PUT)
boolean printChecklog(Integer checkid, Context context) { boolean printChecklog(Integer checkid, Context context) {
@ -496,31 +491,31 @@ public class ChecklogController {
CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId()); CngUser user = cngUserRepository.findBySysUserId(context.getUser().getId());
return checklogService.printChecklog(checkid, dept, user); return checklogService.printChecklog(checkid, dept, user);
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "checkklogid", method = RequestMethod.GET) @RequestMapping(value = "checkklogid", method = RequestMethod.GET)
CheckLog findCheckLogById(Integer id) { CheckLog findCheckLogById(Integer id) {
return checklogRepository.findCheckLogById(id); return checklogRepository.findCheckLogById(id);
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "history", method = RequestMethod.GET) @RequestMapping(value = "history", method = RequestMethod.GET)
List<CheckLogBott> getHistory(Integer bottleId) { List<CheckLogBott> getHistory(Integer bottleId) {
List<CheckLogBott> bott = new ArrayList<CheckLogBott>(); List<CheckLogBott> bott = new ArrayList<CheckLogBott>();
if(bottleId!=null && bottleId>0){
if (bottleId != null && bottleId > 0) {
bott = checklogRepository.getHistory(bottleId); bott = checklogRepository.getHistory(bottleId);
} }
return bott; return bott;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "updateRowState", method = RequestMethod.PUT) @RequestMapping(value = "updateRowState", method = RequestMethod.PUT)
CheckLog updateRowState(Integer id,Context context){
String userId= context.getPosition().getDepartment().getId();
CheckLog updateRowState(Integer id, Context context) {
String userId = context.getPosition().getDepartment().getId();
AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId); AuthorityDepartment regDept = authorityDepartmentRepository.findByMemo(userId);
String myuserId = context.getUser().getId(); String myuserId = context.getUser().getId();
CngUser regUser= authorityDepartmentRepository.findByUser(myuserId);
CheckLog log = repository.get(CheckLog.class, id);
CngUser regUser = authorityDepartmentRepository.findByUser(myuserId);
CheckLog log = repository.get(CheckLog.class, id);
log.setRowState(2); log.setRowState(2);
log.setDateUpdate(new Date()); log.setDateUpdate(new Date());
log.setTouchDeptId(regDept.getId()); log.setTouchDeptId(regDept.getId());
@ -529,31 +524,31 @@ public class ChecklogController {
logOperation.saveCngcdCheckLog(checkLog, regUser.getUsername(), Operations.DELETE, ""); logOperation.saveCngcdCheckLog(checkLog, regUser.getUsername(), Operations.DELETE, "");
return checkLog; return checkLog;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "editSelectedUser", method = RequestMethod.PUT) @RequestMapping(value = "editSelectedUser", method = RequestMethod.PUT)
void editChecker(Integer userId, String selectedName, Context context) { void editChecker(Integer userId, String selectedName, Context context) {
List<Position> postlist = context.getDepartment().getPositions(); List<Position> postlist = context.getDepartment().getPositions();
List<CngUser> userList = new ArrayList<CngUser>(); List<CngUser> userList = new ArrayList<CngUser>();
for (Position position : postlist) {
Set<User> setuser = position.getUsers();
Iterator<User> it = setuser.iterator();
while(it.hasNext()) {
User user = it.next();
if(!StringUtil.isNullOrBlank(user.getSignature())) {
CngUser cnguser = cngUserRepository.findBySysUserId(user.getId());
if(!StringUtil.isNullOrBlank(cnguser.getEmail()) && cnguser.getEmail().equals(selectedName)){
cnguser.setEmail("");
}
userList.add(cnguser);
for (Position position : postlist) {
Set<User> setuser = position.getUsers();
Iterator<User> it = setuser.iterator();
while (it.hasNext()) {
User user = it.next();
if (!StringUtil.isNullOrBlank(user.getSignature())) {
CngUser cnguser = cngUserRepository.findBySysUserId(user.getId());
if (!StringUtil.isNullOrBlank(cnguser.getEmail()) && cnguser.getEmail().equals(selectedName)) {
cnguser.setEmail("");
} }
userList.add(cnguser);
} }
} }
CngUser editBean = repository.get(CngUser.class,userId);
}
CngUser editBean = repository.get(CngUser.class, userId);
editBean.setEmail(selectedName); editBean.setEmail(selectedName);
repository.save(editBean); repository.save(editBean);
} }
} }

+ 0
- 3
src/main/java/com/ciotea/cdcng/front/application/specialInspection/checkmanage/PrintBottcertController.java View File

@ -77,7 +77,6 @@ public class PrintBottcertController {
/** /**
* 根据车牌号 查询气瓶详情 * 根据车牌号 查询气瓶详情
* @param id
* @return * @return
*/ */
@ResponseBody//printBottcert/getBottleByPlatenum @ResponseBody//printBottcert/getBottleByPlatenum
@ -100,7 +99,6 @@ public class PrintBottcertController {
} }
/** /**
* 打印气瓶使用登记证 * 打印气瓶使用登记证
* @param bean
* @param context * @param context
* @return * @return
*/ */
@ -153,7 +151,6 @@ public class PrintBottcertController {
/** /**
* 注销气瓶使用登记证 * 注销气瓶使用登记证
* @param bean
* @param context * @param context
* @return * @return
*/ */

+ 38
- 39
src/main/java/com/ciotea/cdcng/front/application/system/SystemController.java View File

@ -31,6 +31,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository; import com.ciotea.cdcng.front.domain.chart.carUseChart.repository.CarUseRepository;
@ -67,40 +68,40 @@ public class SystemController {
@Resource @Resource
UserService userService; UserService userService;
@Resource @Resource
ModuleService moduleService; ModuleService moduleService;
@Resource @Resource
MessageRepository messageRepository; MessageRepository messageRepository;
@Resource @Resource
AuthorityDepartmentRepository authorityDepartmentRepository; AuthorityDepartmentRepository authorityDepartmentRepository;
@Resource @Resource
MessageService messageService; MessageService messageService;
@Resource @Resource
CarUseRepository carUseRepository; CarUseRepository carUseRepository;
@Resource @Resource
CarUseService carUseService; CarUseService carUseService;
@Resource @Resource
CngUserRepository cngUserRepository; CngUserRepository cngUserRepository;
@Resource @Resource
Repository commonRepository; Repository commonRepository;
@Resource @Resource
ResetRepository resetRepository; ResetRepository resetRepository;
@Resource @Resource
CarTypeDictRepository carTypeDictRepository; CarTypeDictRepository carTypeDictRepository;
@Resource @Resource
OpeningTimeRepo openingTimeRepo; OpeningTimeRepo openingTimeRepo;
@ResponseBody @ResponseBody
@RequestMapping(value = "user", method = RequestMethod.GET) @RequestMapping(value = "user", method = RequestMethod.GET)
User getUser(Context ctx) { User getUser(Context ctx) {
@ -109,15 +110,13 @@ public class SystemController {
/** /**
* 单点登录方人员信息 * 单点登录方人员信息
* @param jsonObject
* @param
* @return * @return
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "/point/getUser", method = RequestMethod.POST)
public PointUserInfo getUserPointInfo(JSONObject jsonObject){
System.out.println("俺来了Controller");
System.out.println(jsonObject.getString("code"));
return userService.getUserPointInfo(jsonObject);
@RequestMapping(value = "/point/getUser", method = RequestMethod.GET)
public PointUserInfo getUserPointInfo(@RequestParam("code") String code){
return userService.getUserPointInfo(code);
} }
@ResponseBody @ResponseBody
@ -125,25 +124,25 @@ public class SystemController {
Department getDept(Context ctx) { Department getDept(Context ctx) {
return ctx.getDepartment(); return ctx.getDepartment();
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "user/organization", method = RequestMethod.GET) @RequestMapping(value = "user/organization", method = RequestMethod.GET)
Organization getUserOrganization(Context ctx) { Organization getUserOrganization(Context ctx) {
return ctx.getOrganization(); return ctx.getOrganization();
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "user/password", method = RequestMethod.PUT) @RequestMapping(value = "user/password", method = RequestMethod.PUT)
void putPassword(PasswordUpdate passwordUpdate, Context ctx) { void putPassword(PasswordUpdate passwordUpdate, Context ctx) {
userService.updatePassword(ctx.getUser().getId(), passwordUpdate); userService.updatePassword(ctx.getUser().getId(), passwordUpdate);
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "moduleGroups", method = RequestMethod.GET) @RequestMapping(value = "moduleGroups", method = RequestMethod.GET)
List<ModuleGroup> getModuleGroups() { List<ModuleGroup> getModuleGroups() {
return repository.getAll(ModuleGroup.class, Order.asc("order")); return repository.getAll(ModuleGroup.class, Order.asc("order"));
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "checkNewMsg", method = RequestMethod.GET) @RequestMapping(value = "checkNewMsg", method = RequestMethod.GET)
Integer checkNewMsg(Context context) { Integer checkNewMsg(Context context) {
@ -157,7 +156,7 @@ public class SystemController {
} }
return list.size(); return list.size();
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "checkNewFile", method = RequestMethod.GET) @RequestMapping(value = "checkNewFile", method = RequestMethod.GET)
Integer checkNewFile(Context context) { Integer checkNewFile(Context context) {
@ -181,13 +180,13 @@ public class SystemController {
} }
return new AuthorityDepartment(); return new AuthorityDepartment();
} }
@Resource @Resource
ResponseBodyCacheManager responseBodyCacheManager; ResponseBodyCacheManager responseBodyCacheManager;
private PermissionFilter fiter = null; private PermissionFilter fiter = null;
@PostConstruct @PostConstruct
private void init() { private void init() {
new Timer(true).schedule(new TimerTask() { new Timer(true).schedule(new TimerTask() {
@ -209,7 +208,7 @@ public class SystemController {
List<Module> getModulesInGroup(String moduleGroupId, Context ctx) { List<Module> getModulesInGroup(String moduleGroupId, Context ctx) {
return moduleService.getModulesInGroupOfUser(moduleGroupId, ctx.getUser().getId()); return moduleService.getModulesInGroupOfUser(moduleGroupId, ctx.getUser().getId());
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "userType", method = RequestMethod.GET) @RequestMapping(value = "userType", method = RequestMethod.GET)
Map<String, String> getUserType(Context context){ Map<String, String> getUserType(Context context){
@ -221,7 +220,7 @@ public class SystemController {
} }
return map; return map;
} }
//车辆在用情况统计 //车辆在用情况统计
@ResponseBody @ResponseBody
@RequestMapping(value = "carUseChart", method = RequestMethod.GET) @RequestMapping(value = "carUseChart", method = RequestMethod.GET)
@ -244,7 +243,7 @@ public class SystemController {
carList.get(carList.size()-1).setSum(sum); carList.get(carList.size()-1).setSum(sum);
return carList; return carList;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "carUseAreaChart", method = RequestMethod.GET) @RequestMapping(value = "carUseAreaChart", method = RequestMethod.GET)
List<List<CarUseAreaVo>> getCarUseAreaChart(PermissionFilter permissionFilter,Context context){ List<List<CarUseAreaVo>> getCarUseAreaChart(PermissionFilter permissionFilter,Context context){
@ -258,7 +257,7 @@ public class SystemController {
} }
return carUseService.getCarUseAreaChart(permissionFilter); return carUseService.getCarUseAreaChart(permissionFilter);
} }
//导出[质监局-气瓶使用登记证发放统计]的电子表格 //导出[质监局-气瓶使用登记证发放统计]的电子表格
@ResponseBody @ResponseBody
@RequestMapping(value = "exportCaruseExcelForQuality", method = RequestMethod.GET) @RequestMapping(value = "exportCaruseExcelForQuality", method = RequestMethod.GET)
@ -307,8 +306,8 @@ public class SystemController {
bytes.length, new Date())); bytes.length, new Date()));
ServletUtil.respondBytes(res, bytes); ServletUtil.respondBytes(res, bytes);
} }
// @ResponseBody
// @ResponseBody
// @RequestMapping(value = "getDeptName", method = RequestMethod.GET) // @RequestMapping(value = "getDeptName", method = RequestMethod.GET)
// Integer getDeptName(Context context){ // Integer getDeptName(Context context){
// Department dept = context.getDepartment(); // Department dept = context.getDepartment();
@ -323,8 +322,8 @@ public class SystemController {
ResetVo vo = resetRepository.isReset(user.getId()); ResetVo vo = resetRepository.isReset(user.getId());
return vo; return vo;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET) @RequestMapping(value = "refitinquiryDept", method = RequestMethod.GET)
List<AuthorityDepartment> getRegDepts() { List<AuthorityDepartment> getRegDepts() {
@ -332,21 +331,21 @@ public class SystemController {
List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types); List<AuthorityDepartment> list = authorityDepartmentRepository.findByDeptTypes(types);
return list; return list;
} }
@ResponseBody @ResponseBody
@RequestMapping(value="selectCngTypeDictAll" , method= RequestMethod.GET) @RequestMapping(value="selectCngTypeDictAll" , method= RequestMethod.GET)
List<CngTypeDict> selectcngAll(){ List<CngTypeDict> selectcngAll(){
return carTypeDictRepository.selectCngTypeDict(); return carTypeDictRepository.selectCngTypeDict();
} }
@ResponseBody @ResponseBody
@RequestMapping(value="getAreas", method = RequestMethod.GET) @RequestMapping(value="getAreas", method = RequestMethod.GET)
List<AreaDict> getAllArea(){ List<AreaDict> getAllArea(){
return carTypeDictRepository.selectAreaDict(); return carTypeDictRepository.selectAreaDict();
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "getPermissionFilter", method = RequestMethod.GET) @RequestMapping(value = "getPermissionFilter", method = RequestMethod.GET)
PermissionFilter getPermissionFilter(Context context) { PermissionFilter getPermissionFilter(Context context) {
@ -365,7 +364,7 @@ public class SystemController {
// } // }
return permissionFilter; return permissionFilter;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "openingLongin", method = RequestMethod.GET) @RequestMapping(value = "openingLongin", method = RequestMethod.GET)
public int openingLongin() throws ParseException{ public int openingLongin() throws ParseException{

+ 2
- 2
src/main/java/com/ciotea/cdcng/front/domain/carPremises/makeQRCode/service/MakeQRCodeServiceImpl.java View File

@ -66,7 +66,7 @@ public class MakeQRCodeServiceImpl implements MakeQRCodeService {
v.forProperty("carModel").notBlank().maxLength(100); v.forProperty("carModel").notBlank().maxLength(100);
v.forProperty("carWeight").notBlank().maxLength(5).isNum(); v.forProperty("carWeight").notBlank().maxLength(5).isNum();
v.forProperty("bottCode").notBlank().maxLength(20); v.forProperty("bottCode").notBlank().maxLength(20);
v.forProperty("capacity").notBlank().maxLength(5).isNum().isInRange(0, 500.0);
v.forProperty("capacity").notBlank().maxLength(5).isNum().isInRange(0, 2000.0);
v.forProperty("registDate").notBlank(); v.forProperty("registDate").notBlank();
v.forProperty("weight").notBlank().maxLength(5).isNum(); v.forProperty("weight").notBlank().maxLength(5).isNum();
v.check(); v.check();
@ -95,7 +95,7 @@ public class MakeQRCodeServiceImpl implements MakeQRCodeService {
v.forProperty("carModel").notBlank().maxLength(40); v.forProperty("carModel").notBlank().maxLength(40);
v.forProperty("carWeight").notBlank().maxLength(5).isNum(); v.forProperty("carWeight").notBlank().maxLength(5).isNum();
v.forProperty("bottCode").notBlank().maxLength(20); v.forProperty("bottCode").notBlank().maxLength(20);
v.forProperty("capacity").notBlank().maxLength(5).isNum().isInRange(0, 500.0);
v.forProperty("capacity").notBlank().maxLength(5).isNum().isInRange(0, 2000.0);
v.forProperty("registDate").notBlank(); v.forProperty("registDate").notBlank();
v.forProperty("weight").notBlank().maxLength(5).isNum(); v.forProperty("weight").notBlank().maxLength(5).isNum();
v.check(); v.check();

+ 9
- 6
src/main/java/com/ciotea/cdcng/front/domain/entity/system/User.java View File

@ -62,6 +62,12 @@ public class User implements Serializable {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private YesNo isLocked; private YesNo isLocked;
/**
* 登录失败次数
*/
@Column(name = "count")
private Integer count;
@Column(name = "_DELETED") @Column(name = "_DELETED")
private String isDeleted; private String isDeleted;
@ -92,11 +98,7 @@ public class User implements Serializable {
@Column(name = "_PASSWORD_UPDATE_TIME") @Column(name = "_PASSWORD_UPDATE_TIME")
private Date updataTime; private Date updataTime;
/**
* 登录失败次数
*/
@Column(name = "count")
private Integer count;
@ManyToOne @ManyToOne
@JoinColumn(name = "_LOGIN_POSITION_ID") @JoinColumn(name = "_LOGIN_POSITION_ID")
@ -258,6 +260,7 @@ public class User implements Serializable {
public void setTel(String tel) { public void setTel(String tel) {
this.tel = tel; this.tel = tel;
} }
} }

+ 2
- 1
src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/bottle/repository/AirBottleRepositoryImpl.java View File

@ -71,7 +71,8 @@ public class AirBottleRepositoryImpl implements AirBottleRepository{
param.put("permissionFilter", permissionFilter); param.put("permissionFilter", permissionFilter);
param.put("plateNum", bean.getPlatenum()); param.put("plateNum", bean.getPlatenum());
param.put("vin", bean.getVin()); param.put("vin", bean.getVin());
param.put("refitState", bean.getRefitState());
return sqlSessionYunsa.selectList(NS + "selectBottleByMybatis", param, pagination); return sqlSessionYunsa.selectList(NS + "selectBottleByMybatis", param, pagination);
} }

+ 2
- 2
src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/bottle/service/AirBottleServiceImpl.java View File

@ -66,7 +66,7 @@ public class AirBottleServiceImpl implements AirBottleService{
v.forProperty("installDate").notBlank().isDate().custom(bean.getInstallDate().compareTo(bean.getMadeDate())>0, "安装日期必须大于生产日期!");//安装日期 v.forProperty("installDate").notBlank().isDate().custom(bean.getInstallDate().compareTo(bean.getMadeDate())>0, "安装日期必须大于生产日期!");//安装日期
v.forProperty("validYear").maxLength(5).isNum();//使用年限 v.forProperty("validYear").maxLength(5).isNum();//使用年限
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);//气瓶型号 v.forProperty("bottModel").hasNoChineseWord().maxLength(30);//气瓶型号
v.forProperty("capacity").notBlank().isNum().isInRange(0, 500.0).length(1, 5).hasNoChineseWord();//气瓶容积
v.forProperty("capacity").notBlank().isNum().isInRange(0, 2000.0).length(1, 5).hasNoChineseWord();//气瓶容积
v.check(); v.check();
if("".equals(bean.getRatedFillCount())){ if("".equals(bean.getRatedFillCount())){
bean.setRatedFillCount(null); bean.setRatedFillCount(null);
@ -100,7 +100,7 @@ public class AirBottleServiceImpl implements AirBottleService{
v.forProperty("installDate").notBlank().isDate().custom(bean.getInstallDate().compareTo(bean.getMadeDate())>0, "安装日期必须大于生产日期!");//安装日期 v.forProperty("installDate").notBlank().isDate().custom(bean.getInstallDate().compareTo(bean.getMadeDate())>0, "安装日期必须大于生产日期!");//安装日期
v.forProperty("validYear").maxLength(5).isNum(); // 使用年限 v.forProperty("validYear").maxLength(5).isNum(); // 使用年限
v.forProperty("bottModel").hasNoChineseWord().maxLength(30); // 气瓶型号 v.forProperty("bottModel").hasNoChineseWord().maxLength(30); // 气瓶型号
v.forProperty("capacity").notBlank().isNum().isInRange(0, 500.0).length(1, 5).hasNoChineseWord(); // 气瓶容积
v.forProperty("capacity").notBlank().isNum().isInRange(0, 2000.0).length(1, 5).hasNoChineseWord(); // 气瓶容积
v.check(); v.check();
if("".equals(bean.getRatedFillCount())){ if("".equals(bean.getRatedFillCount())){
bean.setRatedFillCount(null); bean.setRatedFillCount(null);

+ 1
- 1
src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/refittingCar/entity/CngCdCar.java View File

@ -80,7 +80,7 @@ public class CngCdCar implements Serializable {
@Column(name = "engineid") @Column(name = "engineid")
private String engineid; private String engineid;
/** /**
*
* 0 改装 1原装 2过户
*/ */
@Column(name = "isorig") @Column(name = "isorig")
private String isorig; private String isorig;

+ 489
- 493
src/main/java/com/ciotea/cdcng/front/domain/refittingFactory/refittingCar/repository/CngCdCarStrategyImpl.java
File diff suppressed because it is too large
View File


+ 2
- 0
src/main/java/com/ciotea/cdcng/front/domain/repository/system/UserRepository.java View File

@ -26,4 +26,6 @@ public interface UserRepository {
void updateByUsername(User realUser); void updateByUsername(User realUser);
User getPasswordByPhone(String mobile); User getPasswordByPhone(String mobile);
User getByPassword(String password);
} }

+ 5
- 0
src/main/java/com/ciotea/cdcng/front/domain/repository/system/impl/UserRepositoryImpl.java View File

@ -139,4 +139,9 @@ public class UserRepositoryImpl implements UserRepository {
return sqlSessionYunsa.selectOne(NS + "getPasswordByPhone",mobile); return sqlSessionYunsa.selectOne(NS + "getPasswordByPhone",mobile);
} }
@Override
public User getByPassword(String password) {
return sqlSessionYunsa.selectOne(NS + "getByPassword",password);
}
} }

+ 11
- 11
src/main/java/com/ciotea/cdcng/front/domain/service/system/UserService.java View File

@ -33,7 +33,7 @@ public interface UserService {
* 删除用户 * 删除用户
*/ */
void removeUser(String id); void removeUser(String id);
/** /**
* 修改用户密码 * 修改用户密码
*/ */
@ -43,12 +43,12 @@ public interface UserService {
* 重置用户密码 * 重置用户密码
*/ */
void addUserPasswordResetting(String userId); void addUserPasswordResetting(String userId);
/** /**
* 修改用户密码 * 修改用户密码
*/ */
void updateUserPassword(String userId, String password); void updateUserPassword(String userId, String password);
User updateUserLockState(String userId, YesNo yesOrNo); User updateUserLockState(String userId, YesNo yesOrNo);
void addUserPositionMapping(String username, String positionId); void addUserPositionMapping(String username, String positionId);
@ -60,8 +60,8 @@ public interface UserService {
User removeUserCA(String userId); User removeUserCA(String userId);
void updateLoginPosition(String userId, String positionId); void updateLoginPosition(String userId, String positionId);
/** /**
* 获取部门下的用户 * 获取部门下的用户
*/ */
@ -71,13 +71,13 @@ public interface UserService {
* 获取机构下的用户 * 获取机构下的用户
*/ */
List<User> getOrganizationUsers(String organizationId, String positionCode); List<User> getOrganizationUsers(String organizationId, String positionCode);
void uploadAnnex(String signatureUrl, String userId, String signature,String path); void uploadAnnex(String signatureUrl, String userId, String signature,String path);
boolean checkSignature(String signature); boolean checkSignature(String signature);
User getByUserName(String username); User getByUserName(String username);
/** /**
* 更改修改信息时间为null * 更改修改信息时间为null
* @param user * @param user
@ -86,8 +86,8 @@ public interface UserService {
/** /**
* 单点登录成功后获取主平台的当前用户信息 * 单点登录成功后获取主平台的当前用户信息
* @param jsonObject
* @param
* @return * @return
*/ */
PointUserInfo getUserPointInfo(JSONObject jsonObject);
PointUserInfo getUserPointInfo(String code);
} }

+ 36
- 26
src/main/java/com/ciotea/cdcng/front/domain/service/system/impl/UserServiceImpl.java View File

@ -38,10 +38,10 @@ import org.springframework.stereotype.Service;
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
public static final String ADMIN_USERNAME = "admin"; public static final String ADMIN_USERNAME = "admin";
@Resource @Resource
Repository commonRepository; Repository commonRepository;
@Resource @Resource
UserRepository userRepository; UserRepository userRepository;
@ -50,13 +50,13 @@ public class UserServiceImpl implements UserService {
@Resource @Resource
DepartmentService departmentService; DepartmentService departmentService;
@Resource @Resource
ModuleGroupRepository moduleGroupRepository; ModuleGroupRepository moduleGroupRepository;
@Resource @Resource
FileService fileService; FileService fileService;
@PostConstruct @PostConstruct
private void addAdmin() { private void addAdmin() {
@ -93,7 +93,7 @@ public class UserServiceImpl implements UserService {
v.forProperty("address").notNull().length(1, 50); v.forProperty("address").notNull().length(1, 50);
v.forProperty("signature").custom(checkSignature(o.getSignature()), "请检查上传的图片签名格式"); v.forProperty("signature").custom(checkSignature(o.getSignature()), "请检查上传的图片签名格式");
v.check(); v.check();
User user = new User(); User user = new User();
user.setUsername(o.getUsername()); user.setUsername(o.getUsername());
@ -113,11 +113,11 @@ public class UserServiceImpl implements UserService {
@Override @Override
public User updateUser(User o) { public User updateUser(User o) {
// Module d = moduleGroupRepository.getModuleWithKey("carPath"); // Module d = moduleGroupRepository.getModuleWithKey("carPath");
// d.setHeight(0); // d.setHeight(0);
User user; User user;
Validator v = new Validator(o); Validator v = new Validator(o);
v.forProperty("id").notNull().custom((user = commonRepository.get(User.class, o.getId())) != null, "用户不存在"); v.forProperty("id").notNull().custom((user = commonRepository.get(User.class, o.getId())) != null, "用户不存在");
@ -160,7 +160,7 @@ public class UserServiceImpl implements UserService {
user.setUsername(user.getUsername() + "[已删除 " + DateUtil.getDateTime() + "]"); user.setUsername(user.getUsername() + "[已删除 " + DateUtil.getDateTime() + "]");
user.setIsDeleted(YesNo.YES.toString()); user.setIsDeleted(YesNo.YES.toString());
} }
@Override @Override
public void updatePassword(String userId, PasswordUpdate o) { public void updatePassword(String userId, PasswordUpdate o) {
User user = commonRepository.get(User.class, userId); User user = commonRepository.get(User.class, userId);
@ -172,7 +172,7 @@ public class UserServiceImpl implements UserService {
v.forProperty("newPassword").notNull().length(8, 32).idStrAndIntAndSpe(); v.forProperty("newPassword").notNull().length(8, 32).idStrAndIntAndSpe();
v.forProperty("confirmPassword").length(8, 32).idStrAndIntAndSpe().custom(o.getNewPassword().equals(o.getConfirmPassword()), "两次密码输入必须一致"); v.forProperty("confirmPassword").length(8, 32).idStrAndIntAndSpe().custom(o.getNewPassword().equals(o.getConfirmPassword()), "两次密码输入必须一致");
v.check(); v.check();
user.setUpdataTime(new Date());
user.setUpdataTime(new Date());
user.setPassword(EncryptUtil.encrypt(o.getNewPassword())); user.setPassword(EncryptUtil.encrypt(o.getNewPassword()));
} }
@ -187,7 +187,7 @@ public class UserServiceImpl implements UserService {
} }
user.setPassword(EncryptUtil.encrypt(user.getUsername())); user.setPassword(EncryptUtil.encrypt(user.getUsername()));
} }
@Override @Override
public void updateUserPassword(String userId, String password) { public void updateUserPassword(String userId, String password) {
User user = commonRepository.get(User.class, userId); User user = commonRepository.get(User.class, userId);
@ -287,7 +287,7 @@ public class UserServiceImpl implements UserService {
user.setNo(null); user.setNo(null);
return user; return user;
} }
@Override @Override
public void updateLoginPosition(String userId, String positionId) { public void updateLoginPosition(String userId, String positionId) {
User user = commonRepository.get(User.class, userId); User user = commonRepository.get(User.class, userId);
@ -361,10 +361,10 @@ public class UserServiceImpl implements UserService {
public void uploadAnnex(String signatureUrl, String userId, String signature,String path) { public void uploadAnnex(String signatureUrl, String userId, String signature,String path) {
//TODO //TODO
if (!StringUtil.isNullOrEmpty(signature)) { if (!StringUtil.isNullOrEmpty(signature)) {
// 上传到文件服务器
fileService.uploadSignature(fileService.getFile(signatureUrl),signature, userId,path);
// 上传到文件服务器
fileService.uploadSignature(fileService.getFile(signatureUrl),signature, userId,path);
} }
} }
@Override @Override
@ -376,7 +376,7 @@ public class UserServiceImpl implements UserService {
return false; return false;
}else{ }else{
if (!"png".equalsIgnoreCase(str[1]) && !"jpg".equalsIgnoreCase(str[1]) if (!"png".equalsIgnoreCase(str[1]) && !"jpg".equalsIgnoreCase(str[1])
&& !"bmp".equalsIgnoreCase(str[1])
&& !"bmp".equalsIgnoreCase(str[1])
&& !"jpeg".equalsIgnoreCase(str[1])){ && !"jpeg".equalsIgnoreCase(str[1])){
// v.forProperty("signature").custom(boo, "请检查上传的图片签名格式"); // v.forProperty("signature").custom(boo, "请检查上传的图片签名格式");
return false; return false;
@ -395,9 +395,8 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public PointUserInfo getUserPointInfo(JSONObject jsonObject) {
public PointUserInfo getUserPointInfo(String code) {
PointUserInfo pointUserInfo = new PointUserInfo(); PointUserInfo pointUserInfo = new PointUserInfo();
String code = jsonObject.getString("code");
/*==============*/ /*==============*/
String corpsecret = "04f36b34a3c044c094783e48e6524834"; String corpsecret = "04f36b34a3c044c094783e48e6524834";
String accessToken = null; String accessToken = null;
@ -462,7 +461,7 @@ public class UserServiceImpl implements UserService {
String getUserInfoUrl = "http://221.237.111.10:50080/uranus/cgi-bin/request/getuserinfo"; String getUserInfoUrl = "http://221.237.111.10:50080/uranus/cgi-bin/request/getuserinfo";
connection = null; connection = null;
reader = null; reader = null;
System.out.println(code);
try { try {
// 构造完整的请求URL // 构造完整的请求URL
String query = String.format("access_token=%s&code=%s", String query = String.format("access_token=%s&code=%s",
@ -486,11 +485,22 @@ public class UserServiceImpl implements UserService {
} }
// 解析 JSON 响应 // 解析 JSON 响应
String jsonResponse = response.toString(); String jsonResponse = response.toString();
JSONObject responseJSONObject = JSONObject.parseObject(jsonResponse);
String accessTokenCode = responseJSONObject.getString("code");
if ("0".equals(accessTokenCode)){
String mobile = responseJSONObject.getJSONObject("data").getString("mobile");
pointUserInfo = responseJSONObject.getJSONObject("data").toJavaObject(PointUserInfo.class);
System.out.println(jsonResponse);
// JSONObject responseJSONObject = JSONObject.parseObject(jsonResponse);
// JSONObject jsonObject = JSONObject.parseObject(jsonResponse);
// String accessTokenCode = responseJSONObject.getString("code");
System.out.println("============");
System.out.println("============");
System.out.println("============");
System.out.println("============");
// System.out.println(jsonObject);
String split = jsonResponse.split("mobile")[1];
System.out.println(split);
String mobile = split.substring(3, 14);
System.out.println(mobile);
if (mobile != null){
// String mobile = jsonObject.getJSONObject("data").getString("mobile");
// pointUserInfo = jsonObject.getJSONObject("data").toJavaObject(PointUserInfo.class);
// userRepository.getByUserName(pointUserInfo.getName()); // userRepository.getByUserName(pointUserInfo.getName());
User user1 = userRepository.getPasswordByPhone(mobile); User user1 = userRepository.getPasswordByPhone(mobile);
pointUserInfo.setPassword(user1.getPassword()); pointUserInfo.setPassword(user1.getPassword());
@ -528,5 +538,5 @@ public class UserServiceImpl implements UserService {
public User getByUserName(String username) { public User getByUserName(String username) {
return userRepository.getByUserName(username); return userRepository.getByUserName(username);
} }
} }

+ 2
- 2
src/main/java/com/ciotea/cdcng/front/domain/specialInspection/allquery/service/impl/BottgropfcServiceImpl.java View File

@ -102,7 +102,7 @@ public class BottgropfcServiceImpl implements BottgropfcService {
v.forProperty("bottCode").custom(bottgropfcRepository.searchBottByCode(bott v.forProperty("bottCode").custom(bottgropfcRepository.searchBottByCode(bott
.getBottCode()), "气瓶编号已存在"); .getBottCode()), "气瓶编号已存在");
} }
v.forProperty("capacity").notBlank().isNum().isInRange(0, 500.0);
v.forProperty("capacity").notBlank().isNum().isInRange(0, 2000.0);
v.check(); v.check();
bott.setRegUser(user.getId()); bott.setRegUser(user.getId());
bott.setRegDept(dept); bott.setRegDept(dept);
@ -136,7 +136,7 @@ public class BottgropfcServiceImpl implements BottgropfcService {
} }
v.forProperty("madeDate").notBlank(); v.forProperty("madeDate").notBlank();
v.forProperty("nextCheckDate").notBlank(); v.forProperty("nextCheckDate").notBlank();
v.forProperty("capacity").notBlank().isNum().isInRange(0, 500.0);
v.forProperty("capacity").notBlank().isNum().isInRange(0, 2000.0);
v.check(); v.check();
bott.setRowState(b.getRowState()); bott.setRowState(b.getRowState());
bott.setMemo(b.getMemo()); bott.setMemo(b.getMemo());

+ 3
- 1
src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checklog/service/ChecklogService.java View File

@ -6,9 +6,11 @@ import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.Bottle
import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar; import com.ciotea.cdcng.front.domain.refittingFactory.refittingCar.entity.CngCdCar;
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.CheckLog; import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.CheckLog;
import java.util.Map;
public interface ChecklogService { public interface ChecklogService {
CheckLog passCheckLog(String nextCheckDate, String[] bcodes, CheckLog check, CngUser user, AuthorityDepartment dept);
Map<String, Object> passCheckLog(String nextCheckDate, String[] bcodes, CheckLog check, CngUser user, AuthorityDepartment dept);
CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos, CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos,
CheckLog check, CngUser user, AuthorityDepartment dept); CheckLog check, CngUser user, AuthorityDepartment dept);

+ 201
- 254
src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checklog/service/impl/ChecklogServiceImpl.java View File

@ -23,57 +23,52 @@ import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.CheckLo
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.DiscardStandArddict; import com.ciotea.cdcng.front.domain.specialInspection.checkquery.entity.DiscardStandArddict;
import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository; import com.ciotea.cdcng.front.domain.specialInspection.checkquery.repository.ChecklogRepository;
import com.ciotea.cdcng.front.domain.tool.Tool; import com.ciotea.cdcng.front.domain.tool.Tool;
import com.ciotea.cdcng.front.infrastructure.support.utils.ObjectMapper;
import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil;
import com.fasterxml.jackson.databind.JavaType;
import infrastructure.support.exception.AppException; import infrastructure.support.exception.AppException;
import infrastructure.support.validation.Validator; import infrastructure.support.validation.Validator;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jackson.type.JavaType;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ChecklogServiceImpl implements ChecklogService {
public class ChecklogServiceImpl
implements ChecklogService {
@Resource @Resource
Repository repository; Repository repository;
@Resource @Resource
BottleRepository bottleRepository; BottleRepository bottleRepository;
@Resource @Resource
ChecklogRepository checklogRepository; ChecklogRepository checklogRepository;
@Resource @Resource
CngCdCarStrategy cngCdCarStrategy; CngCdCarStrategy cngCdCarStrategy;
@Resource @Resource
MakeQRCodeRepository makeQRCodeRepository; MakeQRCodeRepository makeQRCodeRepository;
@Resource @Resource
AirBottleRepository airBottleRepository; AirBottleRepository airBottleRepository;
@Resource @Resource
CngCdCarStrategy carStrategy; CngCdCarStrategy carStrategy;
@Resource @Resource
CngUserRepository cngUserRepository; CngUserRepository cngUserRepository;
@Resource @Resource
AuthorityDepartmentRepository authorityDepartmentRepository; AuthorityDepartmentRepository authorityDepartmentRepository;
@Resource @Resource
private LogOperation logOperation; private LogOperation logOperation;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override
public CheckLog passCheckLog(String nextCheckDate, String[] bcodes,
CheckLog check, CngUser user, AuthorityDepartment dept) {
public Map<String, Object> passCheckLog(String nextCheckDate, String[] bcodes, CheckLog check, CngUser user, AuthorityDepartment dept) {
Map<String, Object> map = new HashMap();
if (bcodes.length == 0) { if (bcodes.length == 0) {
throw new AppException("请选择气瓶"); throw new AppException("请选择气瓶");
} }
@ -81,96 +76,100 @@ public class ChecklogServiceImpl implements ChecklogService {
v.forProperty("checkCode") v.forProperty("checkCode")
.notBlank() .notBlank()
.length(1, 20) .length(1, 20)
.custom(checklogRepository.getCheckLogByCode(check
.custom(this.checklogRepository.getCheckLogByCode(check
.getCheckCode()) == null, "定检编号存在"); .getCheckCode()) == null, "定检编号存在");
v.forProperty("checkDetail").notBlank(); v.forProperty("checkDetail").notBlank();
v.forProperty("checker.id").notNull(); v.forProperty("checker.id").notNull();
v.forProperty("verifier.id").notNull(); v.forProperty("verifier.id").notNull();
v.forProperty("approver.id").notNull(); v.forProperty("approver.id").notNull();
v.check(); v.check();
check.setRowState(1);
check.setRowState(Integer.valueOf(1));
check.setDateJoined(new Date()); check.setDateJoined(new Date());
check.setDateUpdate(new Date()); check.setDateUpdate(new Date());
check.setRegUserId(user.getId()); check.setRegUserId(user.getId());
check.setAuthorityDepartment(dept); check.setAuthorityDepartment(dept);
check.setCheckDate(sdf.format(new Date()));
check.setApproverDate(sdf.format(new Date()));
check.setVerifyDate(sdf.format(new Date()));
check.setCheckDate(this.sdf.format(new Date()));
check.setApproverDate(this.sdf.format(new Date()));
check.setVerifyDate(this.sdf.format(new Date()));
check.setLogState("1"); check.setLogState("1");
CheckLog clog = repository.save(check);
CheckLog clog = (CheckLog) this.repository.save(check);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<Bottle> bottles = new ArrayList();
for (int i = 0; i < bcodes.length; i++) { for (int i = 0; i < bcodes.length; i++) {
if (!StringUtil.isNullOrEmpty(bcodes[i])) {
Bottle bottle = repository.get(Bottle.class, new Integer(bcodes[i]));
String historyDate = bottle.getNextCheckDate();
// Date d2 = new Date();
if (!StringUtil.isNullOrEmpty(new String[]{bcodes[i]})) {
Bottle bottle = (Bottle) this.repository.get(Bottle.class, new Integer(bcodes[i]));
String historyDate = bottle.getNextCheckDate();
Date d2 = Tool.getNowDate(); Date d2 = Tool.getNowDate();
if(StringUtil.isNullOrEmpty(nextCheckDate) && StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) {
throw new AppException("请输入下次检验日期");
}
if(StringUtil.isNullOrEmpty(nextCheckDate) && !StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) {
Date d3 = null;
try {
d3 = sdf.parse(bottle.getNextCheckDate());
} catch (ParseException e) {
if (StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) {
if (StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) {
throw new AppException("请输入下次检验日期");
} }
if(d3.getTime() < d2.getTime()) {
throw new AppException("请确认气瓶编号为"+bottle.getBottCode()+"的下次检验日期");
} else {
}
if (StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) {
if (!StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) {
Date d3 = null;
try {
d3 = sdf.parse(bottle.getNextCheckDate());
} catch (ParseException localParseException) {
}
if (d3.getTime() < d2.getTime()) {
throw new AppException("请确认气瓶编号为" + bottle.getBottCode() + "的下次检验日期");
}
bottle.setNextCheckDate(bottle.getNextCheckDate()); bottle.setNextCheckDate(bottle.getNextCheckDate());
} }
}
if(!StringUtil.isNullOrEmpty(nextCheckDate) && StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) {
Date d1 = null;
try {
d1 = sdf.parse(nextCheckDate);
} catch (ParseException e) {
}
if(d1.getTime() < d2.getTime()) {
throw new AppException("请确认下次检验日期输入是否正确,应该大于当前日期");
} else {
}
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) {
if (StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) {
Date d1 = null;
try {
d1 = sdf.parse(nextCheckDate);
} catch (ParseException localParseException1) {
}
if (d1.getTime() < d2.getTime()) {
throw new AppException("请确认下次检验日期输入是否正确,应该大于当前日期");
}
bottle.setNextCheckDate(nextCheckDate); bottle.setNextCheckDate(nextCheckDate);
} }
} }
if(!StringUtil.isNullOrEmpty(nextCheckDate) && !StringUtil.isNullOrEmpty(bottle.getNextCheckDate())) {
Date d4 = null;
Date d5 = null;
try {
d4 = sdf.parse(bottle.getNextCheckDate());
d5 = sdf.parse(nextCheckDate);
} catch (Exception e) {
}
// if(d4.getTime() < d2.getTime() || d5.getTime() < d2.getTime()) {
// throw new AppException("上次定检气瓶的下次检验日期小于当前日期");
// }
if(d4.getTime() > d5.getTime()) {
bottle.setNextCheckDate(bottle.getNextCheckDate());
} else {
bottle.setNextCheckDate(nextCheckDate);
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) {
if (!StringUtil.isNullOrEmpty(new String[]{bottle.getNextCheckDate()})) {
Date d4 = null;
Date d5 = null;
try {
d4 = sdf.parse(bottle.getNextCheckDate());
d5 = sdf.parse(nextCheckDate);
} catch (Exception localException) {
}
if (d4.getTime() > d5.getTime()) {
bottle.setNextCheckDate(bottle.getNextCheckDate());
} else {
bottle.setNextCheckDate(nextCheckDate);
}
} }
} }
repository.save(bottle);
logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检时,修改气瓶的下次检验日期");
this.repository.save(bottle);
this.logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检时,修改气瓶的下次检验日期");
CheckLogBott checklogbott = new CheckLogBott(); CheckLogBott checklogbott = new CheckLogBott();
checklogbott.setBottle(bottle.getId()); checklogbott.setBottle(bottle.getId());
checklogbott.setChecklog(clog.getId()); checklogbott.setChecklog(clog.getId());
if(!StringUtil.isNullOrEmpty(nextCheckDate)) {
if (!StringUtil.isNullOrEmpty(new String[]{nextCheckDate})) {
checklogbott.setNextCheckDate(nextCheckDate); checklogbott.setNextCheckDate(nextCheckDate);
} }
// else {
// checklogbott.setNextCheckDate(nextCheckDate);
// }
CheckLogBott logBott= repository.save(checklogbott);
logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联");
CheckLogBott logBott = (CheckLogBott) this.repository.save(checklogbott);
this.logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联");
bottles.add(bottle);
} }
} }
logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息");
return clog;
this.logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息");
map.put("clog", clog);
map.put("bottles", bottles);
return map;
} }
@Override
public CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos,
CheckLog check, CngUser user, AuthorityDepartment dept) {
public CheckLog scrapCheckLog(String[] bcodescraps, String[] scrapmemos, CheckLog check, CngUser user, AuthorityDepartment dept) {
if (bcodescraps.length == 0) { if (bcodescraps.length == 0) {
throw new AppException("请选择气瓶"); throw new AppException("请选择气瓶");
} }
@ -181,7 +180,7 @@ public class ChecklogServiceImpl implements ChecklogService {
v.forProperty("checkCode") v.forProperty("checkCode")
.notNull() .notNull()
.length(1, 20) .length(1, 20)
.custom(checklogRepository.getCheckLogByCode(check
.custom(this.checklogRepository.getCheckLogByCode(check
.getCheckCode()) == null, "定检编号存在"); .getCheckCode()) == null, "定检编号存在");
v.forProperty("checkDetail").notBlank(); v.forProperty("checkDetail").notBlank();
v.forProperty("disCardId.id").notNull(); v.forProperty("disCardId.id").notNull();
@ -190,86 +189,80 @@ public class ChecklogServiceImpl implements ChecklogService {
v.forProperty("approver.id").notNull(); v.forProperty("approver.id").notNull();
v.check(); v.check();
check.setRowState(1);
check.setRowState(Integer.valueOf(1));
check.setDateJoined(new Date()); check.setDateJoined(new Date());
check.setDateUpdate(new Date()); check.setDateUpdate(new Date());
check.setRegUserId(user.getId()); check.setRegUserId(user.getId());
check.setAuthorityDepartment(dept); check.setAuthorityDepartment(dept);
check.setCheckDate(sdf.format(new Date()));
check.setApproverDate(sdf.format(new Date()));
check.setVerifyDate(sdf.format(new Date()));
check.setCheckDate(this.sdf.format(new Date()));
check.setApproverDate(this.sdf.format(new Date()));
check.setVerifyDate(this.sdf.format(new Date()));
check.setLogState("1"); check.setLogState("1");
CheckLog clog = repository.save(check);
CheckLog clog = (CheckLog) this.repository.save(check);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < bcodescraps.length; i++) { for (int i = 0; i < bcodescraps.length; i++) {
if (!StringUtil.isNullOrEmpty(bcodescraps[i])) {
Bottle bottle = repository.get(Bottle.class, new Integer(bcodescraps[i]));
if (!StringUtil.isNullOrEmpty(new String[]{bcodescraps[i]})) {
Bottle bottle = (Bottle) this.repository.get(Bottle.class, new Integer(bcodescraps[i]));
if (bottle != null) { if (bottle != null) {
bottle.setRowState(2);
bottle.setBottState(4);
// bottle.setBottCode("4"); //已报废
if (!StringUtil.isNullOrEmpty(scrapmemos[i])) {
bottle.setRowState(Integer.valueOf(2));
bottle.setBottState(Integer.valueOf(4));
if (!StringUtil.isNullOrEmpty(new String[]{scrapmemos[i]})) {
bottle.setMemo(scrapmemos[i]); bottle.setMemo(scrapmemos[i]);
} }
bottle.setDateUpdate(sdf.format(new Date())); bottle.setDateUpdate(sdf.format(new Date()));
repository.save(bottle);
logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改状态为报废");
CngCdCar car = repository.get(CngCdCar.class, bottle.getCar().getId());
this.repository.save(bottle);
this.logOperation.saveCngcdBottleLog(bottle, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改状态为报废");
CngCdCar car = (CngCdCar) this.repository.get(CngCdCar.class, bottle.getCar().getId());
if (car != null) { if (car != null) {
if(car.getBottleNum() > 0) {
car.setBottleNum(car.getBottleNum() - 1);
if (car.getBottleNum().intValue() > 0) {
car.setBottleNum(Integer.valueOf(car.getBottleNum().intValue() - 1));
} }
if (car.getRfidNum() > 0) {
car.setRfidNum(car.getRfidNum() - 1);
if (car.getRfidNum().intValue() > 0) {
car.setRfidNum(Integer.valueOf(car.getRfidNum().intValue() - 1));
} }
repository.save(car);
logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改气瓶数量、电子标签数量");
this.repository.save(car);
this.logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "定检管理中气瓶报废,修改气瓶数量、电子标签数量");
} }
List<RfidTag> listrfid = checklogRepository.getRfidTagBybottle(bottle.getId());
if(listrfid.size() > 0) {
List<RfidTag> listrfid = this.checklogRepository.getRfidTagBybottle(bottle.getId());
if (listrfid.size() > 0) {
for (RfidTag rfidtag : listrfid) { for (RfidTag rfidtag : listrfid) {
if (rfidtag != null) { if (rfidtag != null) {
rfidtag.setIsvaild("2"); rfidtag.setIsvaild("2");
rfidtag.setDateUpdate(sdf.format(new Date())); rfidtag.setDateUpdate(sdf.format(new Date()));
repository.save(rfidtag);
logOperation.saveCngcdRfidtagLog(rfidtag, user.getUsername(), Operations.DELETE, "定检管理中气瓶报废,删除电子标签信息");
this.repository.save(rfidtag);
this.logOperation.saveCngcdRfidtagLog(rfidtag, user.getUsername(), Operations.DELETE, "定检管理中气瓶报废,删除电子标签信息");
} }
} }
} }
CheckLogBott checklogbott = new CheckLogBott(); CheckLogBott checklogbott = new CheckLogBott();
checklogbott.setBottle(bottle.getId()); checklogbott.setBottle(bottle.getId());
checklogbott.setChecklog(clog.getId()); checklogbott.setChecklog(clog.getId());
CheckLogBott logBott = repository.save(checklogbott);
logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联");
CheckLogBott logBott = (CheckLogBott) this.repository.save(checklogbott);
this.logOperation.saveCngcdChecklogbottLog(logBott, user.getUsername(), Operations.INSERT, "定检时,新增关联");
} }
} }
} }
logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息");
this.logOperation.saveCngcdCheckLog(clog, user.getUsername(), Operations.INSERT, "新增定检信息");
return clog; return clog;
} }
@Override
public CngCdCar updateCar(CngCdCar bean, CngUser user,
AuthorityDepartment dept) {
CngCdCar car = cngCdCarStrategy.findById(bean.getId());
public CngCdCar updateCar(CngCdCar bean, CngUser user, AuthorityDepartment dept) {
CngCdCar car = this.cngCdCarStrategy.findById(bean.getId());
Validator v = new Validator(bean); Validator v = new Validator(bean);
if(/*(bean.getCarState()==2 && bean.getRefitState()==2) ||*/ "".equals(bean.getPlatenum())){
if ("".equals(bean.getPlatenum())) {
v.forProperty("platenum").notBlank().length(1, 10).isVehicle(); v.forProperty("platenum").notBlank().length(1, 10).isVehicle();
}else{
v.forProperty("platenum").notBlank().length(1, 10).isVehicle().custom(cngCdCarStrategy.findByPlateNumAndPcolor(1,bean.getPlatenum(),bean.getPcolor(),bean.getId()).size()==0, "车牌号已存在");
} else {
v.forProperty("platenum").notBlank().length(1, 10).isVehicle().custom(this.cngCdCarStrategy.findByPlateNumAndPcolor(Integer.valueOf(1), bean.getPlatenum(), bean.getPcolor(), bean.getId()).size() == 0, "������������");
} }
v.forProperty("vin").notBlank().isLength(17).isSpecialCharacters().hasNoChineseWord().custom(cngCdCarStrategy.findByVinUp(1,bean.getVin(),bean.getId()).size()==0, "车架号已被使用");
if(bean.getMadeDate()!=null && bean.getNextCheckDate()!=null && bean.getMadeDate().length()>0 && bean.getNextCheckDate().length()>0){
v.forProperty("nextCheckDate").custom(bean.getNextCheckDate().compareTo(bean.getMadeDate())>0, "下次年审日期必须大于出厂日期!");
v.forProperty("vin").notBlank().isLength(17).isSpecialCharacters().hasNoChineseWord().custom(this.cngCdCarStrategy.findByVinUp(Integer.valueOf(1), bean.getVin(), bean.getId()).size() == 0, "��������������");
if ((bean.getMadeDate() != null) && (bean.getNextCheckDate() != null) && (bean.getMadeDate().length() > 0) && (bean.getNextCheckDate().length() > 0)) {
v.forProperty("nextCheckDate").custom(bean.getNextCheckDate().compareTo(bean.getMadeDate()) > 0, "下次年审日期必须大于出厂日期");
} }
v.forProperty("carTypeDict.id").notNull(); v.forProperty("carTypeDict.id").notNull();
v.forProperty("areaDict.id").notNull(); v.forProperty("areaDict.id").notNull();
v.forProperty("pcolor").notNull(); v.forProperty("pcolor").notNull();
v.forProperty("memo").maxLength(200);// 备注
v.forProperty("engineid").notBlank().length(6, 20);//.isNOSpecialCharacters().hasNoChineseWord()
v.forProperty("memo").maxLength(200);
v.forProperty("engineid").notBlank().length(6, 20);
v.forProperty("isorig").notNull(); v.forProperty("isorig").notNull();
ModelDict modeldict = bean.getModelDict(); ModelDict modeldict = bean.getModelDict();
v.forProperty("modelDict").custom(modeldict != null, "请选择车辆厂牌"); v.forProperty("modelDict").custom(modeldict != null, "请选择车辆厂牌");
@ -280,15 +273,15 @@ public class ChecklogServiceImpl implements ChecklogService {
v.forProperty("fromDept").notBlank().length(1, 50); v.forProperty("fromDept").notBlank().length(1, 50);
String isorigtype = bean.getIsorigtype(); String isorigtype = bean.getIsorigtype();
String isorig = bean.getIsorig(); String isorig = bean.getIsorig();
if(isorig.equals("2") && isorigtype.equals("1")) {
v.forProperty("isorigtype").custom(checklogRepository.findCheckDept(bean.getVin(), dept), "请确认此处过户的检验单位是否跟上次检验单位一致");
if ((isorig.equals("2")) && (isorigtype.equals("1"))) {
v.forProperty("isorigtype").custom(this.checklogRepository.findCheckDept(bean.getVin(), dept), "请确认此处过户的检验单位是否跟上次检验单位一致");
} }
if (bean.getOwner() != null) { if (bean.getOwner() != null) {
v.forProperty("owner.name").notNull().length(1, 25); v.forProperty("owner.name").notNull().length(1, 25);
if("0".equals(bean.getOwnerType())){
if ("0".equals(bean.getOwnerType())) {
v.forProperty("owner.idcard").notBlank().isIdCard2().maxLength(20); v.forProperty("owner.idcard").notBlank().isIdCard2().maxLength(20);
} }
if("1".equals(bean.getOwnerType())){
if ("1".equals(bean.getOwnerType())) {
v.forProperty("owner.idcard").notBlank().isOrganizationCode().maxLength(20); v.forProperty("owner.idcard").notBlank().isOrganizationCode().maxLength(20);
} }
v.forProperty("owner.mobile").notBlank().length(1, 12).isPhoneInChina(); v.forProperty("owner.mobile").notBlank().length(1, 12).isPhoneInChina();
@ -303,210 +296,164 @@ public class ChecklogServiceImpl implements ChecklogService {
bean.setNextMaintDate(car.getNextMaintDate()); bean.setNextMaintDate(car.getNextMaintDate());
bean.setRegDept(car.getRegDept()); bean.setRegDept(car.getRegDept());
bean.setRegUser(car.getRegUser()); bean.setRegUser(car.getRegUser());
//lg
if(StringUtil.isNullOrEmpty(bean.getNextCheckDate())){
if (StringUtil.isNullOrEmpty(new String[]{bean.getNextCheckDate()})) {
bean.setNextCheckDate(null); bean.setNextCheckDate(null);
} }
if(StringUtil.isNullOrEmpty(bean.getMadeDate())){
if (StringUtil.isNullOrEmpty(new String[]{bean.getMadeDate()})) {
bean.setMadeDate(null); bean.setMadeDate(null);
} }
CngCdCar cngCdCar = repository.save(bean);
logOperation.saveCngcdCarLog(cngCdCar, user.getUsername(), Operations.UPDATE, "定检管理,修改车辆信息");
CngCdCar cngCdCar = (CngCdCar) this.repository.save(bean);
this.logOperation.saveCngcdCarLog(cngCdCar, user.getUsername(), Operations.UPDATE, "定检管理,修改车辆信息");
return cngCdCar; return cngCdCar;
} }
@Override
public Bottle addBottle(Bottle bottle, CngUser user,
AuthorityDepartment dept) {
CngCdCar car = repository.get(CngCdCar.class, bottle.getCar().getId());
public Bottle addBottle(Bottle bottle, CngUser user, AuthorityDepartment dept) {
CngCdCar car = (CngCdCar) this.repository.get(CngCdCar.class, bottle.getCar().getId());
Validator v = new Validator(bottle); Validator v = new Validator(bottle);
// 气瓶编号唯一性验证
if (bottle.getBottCode().length() > 0) {
v.forProperty("bottCode")
.notBlank()
.isNOSpecialCharacters()
.hasNoChineseWord()
.length(1, 20)
.custom(airBottleRepository.findByBottCodeAndMadeVender(1, bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");// 气瓶编号
if (!bottle.getBottCode().isEmpty()) {
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20).custom(this.airBottleRepository.findByBottCodeAndMadeVender(Integer.valueOf(1), bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");
} else { } else {
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord()
.length(1, 20);
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20);
} }
v.forProperty("bottType.id").notNull();// 气瓶类型
v.forProperty("madeVenderd.id").notNull();// 气瓶生产厂家
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);// 气瓶材质
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();// 气瓶重量
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();// 公称工作压力
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();// 水压试验压力
v.forProperty("madeDate").notBlank().isDate();// 生产日期
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0,"安装日期必须大于出厂日期!");// 安装日期
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积
v.forProperty("bottType.id").notNull();
v.forProperty("madeVenderd.id").notNull();
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("madeDate").notBlank().isDate();
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0, "安装日期必须大于出厂日期");
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期");
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0.0D, 2000.0D);
v.check(); v.check();
if(user != null) {
if (user != null) {
bottle.setRegUser(user.getId()); bottle.setRegUser(user.getId());
} }
if(dept != null) {
if (dept != null) {
bottle.setRegDept(dept); bottle.setRegDept(dept);
} }
bottle.setRowState(1); bottle.setRowState(1);
bottle.setBottState(1); bottle.setBottState(1);
bottle.setDateJoined(sdf.format(new Date()));
bottle.setDateUpdate(sdf.format(new Date()));
bottle.setDateJoined(this.sdf.format(new Date()));
bottle.setDateUpdate(this.sdf.format(new Date()));
car.setBottleNum(car.getBottleNum() + 1); car.setBottleNum(car.getBottleNum() + 1);
repository.save(car);
Bottle bott = repository.save(bottle);
logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "修改气瓶数量");
logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.INSERT, "");
this.repository.save(car);
Bottle bott = (Bottle) this.repository.save(bottle);
if (user != null) {
this.logOperation.saveCngcdCarLog(car, user.getUsername(), Operations.UPDATE, "修改气瓶数量");
}
if (user != null) {
this.logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.INSERT, "");
}
return bott; return bott;
} }
@Override
public Bottle updateBottle(Bottle bottle, CngUser user,
AuthorityDepartment dept) {
public Bottle updateBottle(Bottle bottle, CngUser user, AuthorityDepartment dept) {
Validator v = new Validator(bottle); Validator v = new Validator(bottle);
// 气瓶编号唯一性验证
if (bottle.getBottCode().length() > 0) {
v.forProperty("bottCode")
.notBlank()
.isNOSpecialCharacters()
.hasNoChineseWord()
.length(1, 20)
.custom(airBottleRepository.findByBottCodeAndMadeVender(bottle.getId(), 1, bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");// 气瓶编号
if (!bottle.getBottCode().isEmpty()) {
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20).custom(this.airBottleRepository.findByBottCodeAndMadeVender(bottle.getId(), Integer.valueOf(1), bottle.getBottCode(), bottle.getMadeVenderd().getId()).size() == 0, "该气瓶编号已被使用");
} else { } else {
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord()
.length(1, 20);
v.forProperty("bottCode").notBlank().isNOSpecialCharacters().hasNoChineseWord().length(1, 20);
} }
v.forProperty("bottType.id").notNull();// 气瓶类型
v.forProperty("madeVenderd.id").notNull();// 气瓶生产厂家
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);// 气瓶材质
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();// 气瓶重量
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();// 公称工作压力
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();// 水压试验压力
v.forProperty("madeDate").notBlank().isDate();// 生产日期
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0,"安装日期必须大于出厂日期!");// 安装日期
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积
v.forProperty("bottType.id").notNull();
v.forProperty("madeVenderd.id").notNull();
v.forProperty("bottMaterial").hasNoChineseWord().maxLength(20);
v.forProperty("weight").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("workPress").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("waterPress").hasNoChineseWord().maxLength(5).isNum();
v.forProperty("madeDate").notBlank().isDate();
v.forProperty("installDate").notBlank().isDate().custom(bottle.getInstallDate().compareTo(bottle.getMadeDate()) > 0, "安装日期必须大于出厂日期");
v.forProperty("nextCheckDate").notBlank().isDate().custom(bottle.getNextCheckDate().compareTo(bottle.getInstallDate()) > 0, "下次检验日期必须大于安装日期");
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0.0D, 2000.0D);
v.check(); v.check();
if(user != null) {
if (user != null) {
bottle.setTouchDeptId(user.getId()); bottle.setTouchDeptId(user.getId());
} }
if(dept != null) {
if (dept != null) {
bottle.setTouchDeptId(dept.getId()); bottle.setTouchDeptId(dept.getId());
} }
bottle.setRowState(1);
bottle.setBottState(1);
bottle.setDateUpdate(sdf.format(new Date()));
Bottle bott = repository.save(bottle);
logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.UPDATE, "");
bottle.setRowState(Integer.valueOf(1));
bottle.setBottState(Integer.valueOf(1));
bottle.setDateUpdate(this.sdf.format(new Date()));
Bottle bott = (Bottle) this.repository.save(bottle);
this.logOperation.saveCngcdBottleLog(bott, user.getUsername(), Operations.UPDATE, "");
return bott; return bott;
} }
@Override
public boolean printChecklog(Integer checkid, AuthorityDepartment dept,
CngUser user) {
CheckLog log = repository.get(CheckLog.class, checkid);
public boolean printChecklog(Integer checkid, AuthorityDepartment dept, CngUser user) {
CheckLog log = (CheckLog) this.repository.get(CheckLog.class, checkid);
log.setTouchDeptId(dept.getId()); log.setTouchDeptId(dept.getId());
log.setTouchUserId(user.getId()); log.setTouchUserId(user.getId());
log.setLogState("0"); log.setLogState("0");
repository.save(log);
logOperation.saveCngcdCheckLog(log, user.getUsername(), Operations.UPDATE, "修改打印状态");
this.repository.save(log);
this.logOperation.saveCngcdCheckLog(log, user.getUsername(), Operations.UPDATE, "修改打印状态");
return true; return true;
} }
@Override
public String syncLogs(String bottleCode) { public String syncLogs(String bottleCode) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String result = "1"; String result = "1";
String date = ""; String date = "";
CheckLogSync syncTemp = checklogRepository.getById(1);
if(syncTemp == null){
CheckLogSync syncTemp = this.checklogRepository.getById(Integer.valueOf(1));
if (syncTemp == null) {
date = "2012-01-01 00:00:00"; date = "2012-01-01 00:00:00";
}else{
} else {
Calendar tempDate = Calendar.getInstance(); Calendar tempDate = Calendar.getInstance();
tempDate.setTime(syncTemp.getSyncTime()); tempDate.setTime(syncTemp.getSyncTime());
tempDate.add(Calendar.HOUR_OF_DAY, -1);
tempDate.add(11, -1);
date = sdf.format(tempDate.getTime()); date = sdf.format(tempDate.getTime());
} }
//test
// List<CheckLog> testList = new ArrayList<CheckLog>();
// CheckLog testLog = new CheckLog();
// testLog.setSid("1");
// testLog.setDateJoined(new Date());
// testLog.setPlateNum("川AL946学");
// testLog.setVin("LFV2A1BS3E4582212");
// testLog.setBottleCodes("BB2015009138");
// testLog.setCheckCode("QP222222");
// testLog.setIspass("1");
// testLog.setCheckDetail("合格");
// testLog.setCheckName("郭展飞");
// testLog.setCheckDate("2015-10-31 00:00:00");
// testLog.setVerifyName("袁媛");
// testLog.setVerifyDate("2015-11-01 00:00:00");
// testLog.setApprovName("阴昊");
// testLog.setApproverDate("2015-11-02 00:00:00");
// testLog.setLogState("0");
// testList.add(testLog);
// 发送 GET 请求
String str = HttpRequest.sendGet( String str = HttpRequest.sendGet(
"http://www.chengducng.com/cdcng/special-service/getCheckLogs", "http://www.chengducng.com/cdcng/special-service/getCheckLogs",
"date="+date);
// 发送 POST 请求
// String sr= HttpRequest.sendPost("http://192.168.1.104:8081/cdcng-front/special-service/getBottleDetails",
// "bottleCode=00223085");
"date=" + date);
ObjectMapper m = new ObjectMapper(); ObjectMapper m = new ObjectMapper();
try { try {
// String str = m.writeValueAsString(testList);
JavaType type = m.getTypeFactory().constructParametricType( JavaType type = m.getTypeFactory().constructParametricType(
ArrayList.class, CheckLog.class);
List<CheckLog> list = m.readValue(str, type);
for(CheckLog log : list){
CheckLog tempLog = checklogRepository.findCheckLogBySId(log.getSid());
if(tempLog == null){
CngCdCar car = carStrategy.findCar(log.getPlateNum(), log.getVin());
CngUser checkUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getCheckName()).getId());
CngUser verifiUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getVerifyName()).getId());
CngUser approvUser = authorityDepartmentRepository.findByUser(cngUserRepository.findBySysName(log.getApprovName()).getId());
String bottles[] = log.getBottleCodes().split(",");
log.setRowState(1);
ArrayList.class, new Class[]{CheckLog.class});
List<CheckLog> list = (List) m.readValue(str, type);
for (CheckLog log : list) {
CheckLog tempLog = this.checklogRepository.findCheckLogBySId(log.getSid());
if (tempLog == null) {
CngCdCar car = this.carStrategy.findCar(log.getPlateNum(), log.getVin());
CngUser checkUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getCheckName()).getId());
CngUser verifiUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getVerifyName()).getId());
CngUser approvUser = this.authorityDepartmentRepository.findByUser(this.cngUserRepository.findBySysName(log.getApprovName()).getId());
String[] bottles = log.getBottleCodes().split(",");
log.setRowState(Integer.valueOf(1));
log.setCar(car); log.setCar(car);
log.setChecker(checkUser); log.setChecker(checkUser);
log.setVerifier(verifiUser); log.setVerifier(verifiUser);
log.setApprover(approvUser); log.setApprover(approvUser);
log.setDateUpdate(log.getDateJoined()); log.setDateUpdate(log.getDateJoined());
log.setAuthorityDepartment(repository.get(AuthorityDepartment.class, 55));
if(!StringUtil.isNullOrEmpty(log.getDisCard())){
log.setDisCardId(repository.get(DiscardStandArddict.class, Integer.parseInt(log.getDisCard())));
log.setAuthorityDepartment((AuthorityDepartment) this.repository.get(AuthorityDepartment.class, Integer.valueOf(55)));
if (!StringUtil.isNullOrEmpty(new String[]{log.getDisCard()})) {
log.setDisCardId((DiscardStandArddict) this.repository.get(DiscardStandArddict.class, Integer.valueOf(Integer.parseInt(log.getDisCard()))));
} }
CheckLog saveLog = repository.save(log);
for(int i = 0 ;i < bottles.length; i ++){
CheckLog saveLog = (CheckLog) this.repository.save(log);
for (int i = 0; i < bottles.length; i++) {
CheckLogBott checklogbott = new CheckLogBott(); CheckLogBott checklogbott = new CheckLogBott();
List<Bottle> bott = bottleRepository.findBottleByCode(bottles[i]);
checklogbott.setBottle(bott.get(0).getId());
List<Bottle> bott = this.bottleRepository.findBottleByCode(bottles[i]);
checklogbott.setBottle(((Bottle) bott.get(0)).getId());
checklogbott.setChecklog(saveLog.getId()); checklogbott.setChecklog(saveLog.getId());
repository.save(checklogbott);
this.repository.save(checklogbott);
} }
} }
} }
CheckLogSync sync = new CheckLogSync(); CheckLogSync sync = new CheckLogSync();
sync.setDateJoined(new Date()); sync.setDateJoined(new Date());
sync.setSyncTime(new Date()); sync.setSyncTime(new Date());
sync.setId(1);
repository.save(sync);
sync.setId(Integer.valueOf(1));
this.repository.save(sync);
} catch (Exception e) { } catch (Exception e) {
result = "0"; result = "0";
} }
return result; return result;
} }
@Override
public void delBottle(String bottleCode) { public void delBottle(String bottleCode) {
List<Bottle> list = bottleRepository.findBottleByCode(bottleCode);
List<Bottle> list = this.bottleRepository.findBottleByCode(bottleCode);
} }
} }

+ 1
- 1
src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checkmanage/service/impl/BindBottleServiceImpl.java View File

@ -42,7 +42,7 @@ public class BindBottleServiceImpl implements BindBottleService {
/** /**
* 相当于做的新增操作,绑定后bottcert表中的rowSate改为1;将关联的carState改为4 * 相当于做的新增操作,绑定后bottcert表中的rowSate改为1;将关联的carState改为4
*
* TODO 添加气瓶使用登记证编号
*/ */
@Override @Override
public BottleCert bindBottle(BottleCert bean,AuthorityDepartment regDept,CngUser regUser) { public BottleCert bindBottle(BottleCert bean,AuthorityDepartment regDept,CngUser regUser) {

+ 2
- 2
src/main/java/com/ciotea/cdcng/front/domain/specialInspection/checkmanage/service/impl/BottleAddServiceImpl.java View File

@ -64,7 +64,7 @@ public class BottleAddServiceImpl implements BottleAddService {
v.forProperty("nextCheckDate").notBlank().isDate().custom(bean.getNextCheckDate().compareTo(bean.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期 v.forProperty("nextCheckDate").notBlank().isDate().custom(bean.getNextCheckDate().compareTo(bean.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期
v.forProperty("validYear").maxLength(5).isNum();// 使用年限 v.forProperty("validYear").maxLength(5).isNum();// 使用年限
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号 v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 2000.0);// 气瓶容积
v.check(); v.check();
//添加气瓶业务逻辑 //添加气瓶业务逻辑
CngCdCar car = repository.get(CngCdCar.class, bean.getCar().getId()); CngCdCar car = repository.get(CngCdCar.class, bean.getCar().getId());
@ -136,7 +136,7 @@ public class BottleAddServiceImpl implements BottleAddService {
v.forProperty("nextCheckDate").notBlank().isDate().custom(bean.getNextCheckDate().compareTo(bean.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期 v.forProperty("nextCheckDate").notBlank().isDate().custom(bean.getNextCheckDate().compareTo(bean.getInstallDate()) > 0, "下次检验日期必须大于安装日期!");// 下次检验日期
v.forProperty("validYear").maxLength(5).isNum();// 使用年限 v.forProperty("validYear").maxLength(5).isNum();// 使用年限
v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号 v.forProperty("bottModel").hasNoChineseWord().maxLength(30);// 气瓶型号
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 500.0);// 气瓶容积
v.forProperty("capacity").notBlank().maxLength(5).hasNoChineseWord().isNum().isInRange(0, 2000.0);// 气瓶容积
v.check(); v.check();
//修改气瓶业务逻辑 //修改气瓶业务逻辑
Bottle bottle = repository.get(Bottle.class, bean.getId()); Bottle bottle = repository.get(Bottle.class, bean.getId());

+ 10
- 2
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/password/PasswordEncoder.java View File

@ -1,11 +1,15 @@
package com.ciotea.cdcng.front.infrastructure.spring.security.password; package com.ciotea.cdcng.front.infrastructure.spring.security.password;
import com.ciotea.cdcng.front.domain.entity.system.User;
import com.ciotea.cdcng.front.domain.repository.system.UserRepository;
import com.ciotea.cdcng.front.infrastructure.support.utils.EncryptUtil; import com.ciotea.cdcng.front.infrastructure.support.utils.EncryptUtil;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
public class PasswordEncoder implements org.springframework.security.crypto.password.PasswordEncoder { public class PasswordEncoder implements org.springframework.security.crypto.password.PasswordEncoder {
@Autowired
UserRepository userRepository;
@Override @Override
public String encode(CharSequence rawPassword) { public String encode(CharSequence rawPassword) {
return EncryptUtil.encrypt(rawPassword); return EncryptUtil.encrypt(rawPassword);
@ -13,7 +17,11 @@ public class PasswordEncoder implements org.springframework.security.crypto.pass
@Override @Override
public boolean matches(CharSequence rawPassword, String password) { public boolean matches(CharSequence rawPassword, String password) {
// 解密
// base64解密
User user = userRepository.getByPassword(rawPassword.toString());
if (user != null){
return true;
}
rawPassword = new String(Base64.decodeBase64(rawPassword.toString().getBytes())); rawPassword = new String(Base64.decodeBase64(rawPassword.toString().getBytes()));
return EncryptUtil.match(rawPassword, password); return EncryptUtil.match(rawPassword, password);
} }

+ 15
- 46
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/userdetails/UserDetailsService.java View File

@ -1,31 +1,26 @@
package com.ciotea.cdcng.front.infrastructure.spring.security.userdetails; package com.ciotea.cdcng.front.infrastructure.spring.security.userdetails;
import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import com.ciotea.cdcng.front.domain.repository.system.UserRepository; import com.ciotea.cdcng.front.domain.repository.system.UserRepository;
import com.ciotea.cdcng.front.domain.service.system.impl.UserServiceImpl;
import com.ciotea.cdcng.front.infrastructure.support.application.Constants.YesNo; import com.ciotea.cdcng.front.infrastructure.support.application.Constants.YesNo;
import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil; import com.ciotea.cdcng.front.infrastructure.support.utils.StringUtil;
import org.springframework.stereotype.Service;
@Service("userDetailsService")
public class UserDetailsService implements org.springframework.security.core.userdetails.UserDetailsService { public class UserDetailsService implements org.springframework.security.core.userdetails.UserDetailsService {
@Resource
UserRepository userRepository;
public static com.ciotea.cdcng.front.domain.entity.system.User realUser;
@Resource
UserRepository userRepository;
// @PostConstruct // @PostConstruct
// private void init() { // private void init() {
// new Timer(true).schedule(new TimerTask() { // new Timer(true).schedule(new TimerTask() {
@ -40,42 +35,16 @@ public class UserDetailsService implements org.springframework.security.core.use
// }, 10 * 1000L, 60 * 1000L); // }, 10 * 1000L, 60 * 1000L);
// } // }
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if (StringUtil.isNullOrEmpty(username)) {
throw new UsernameNotFoundException("");
}
com.ciotea.cdcng.front.domain.entity.system.User user = userRepository.getCachedUserWithUsername(username);
if (user == null || user.getIsDeleted().equals(YesNo.YES.toString())) {
throw new UsernameNotFoundException(username);
}
//根据登录名查出用户
realUser = userRepository.getByUserName(username);
if (realUser == null) {//数据库中没有的用户
throw new UsernameNotFoundException("用户不存在!");
}
//由于数据库中的默认值为null所以给他改为0
if (realUser.getCount() == null) {
realUser.setCount(0);
}
if (realUser.getIsLocked().equals(YesNo.NO)) {//没被锁定的情况
//得到当前输入错误的次数
realUser.setCount(realUser.getCount() + 1); //第一次输入等于1第五次输入等于5
//如果次数大于5
if (realUser.getCount() > 5) {//五次机会用完第一次锁定的账号
realUser.setIsLocked(YesNo.YES);
//更新错误次数和是否锁定
userRepository.updateByUsername(realUser);
throw new UsernameNotFoundException("您输入错误密码的次数已达5次,账号已被锁定,请联系管理员解锁!");
}
userRepository.updateByUsername(realUser);
} else {//已经锁定的账号
throw new UsernameNotFoundException("您的账号已被锁定,请联系管理员解锁!");
}
return new User(realUser.getUsername(), realUser.getPassword(), true, true, true, true, AuthorityUtils.createAuthorityList());
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if (StringUtil.isNullOrEmpty(username)) {
throw new UsernameNotFoundException("");
}
com.ciotea.cdcng.front.domain.entity.system.User user = userRepository.getCachedUserWithUsername(username);
if (user == null || user.getIsDeleted().equals(YesNo.YES.toString())) {
throw new UsernameNotFoundException(username);
}
return new User(user.getUsername(), user.getPassword(), true, true, true, user.getIsLocked().equals(YesNo.NO), AuthorityUtils.createAuthorityList());
}
} }

+ 1
- 21
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/AuthenticationFailureHandler.java View File

@ -6,11 +6,8 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ciotea.cdcng.front.infrastructure.spring.security.userdetails.UserDetailsService;
import com.ciotea.cdcng.front.infrastructure.support.application.Constants;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AccountExpiredException; import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
@ -25,30 +22,13 @@ import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil;
public class AuthenticationFailureHandler implements org.springframework.security.web.authentication.AuthenticationFailureHandler { public class AuthenticationFailureHandler implements org.springframework.security.web.authentication.AuthenticationFailureHandler {
@Autowired
private UserDetailsService userDetailsService;
private static final Logger logger = LogManager.getLogger(AuthenticationFailureHandler.class); private static final Logger logger = LogManager.getLogger(AuthenticationFailureHandler.class);
@Override @Override
public void onAuthenticationFailure(HttpServletRequest req, HttpServletResponse resp, AuthenticationException exception) throws IOException, ServletException { public void onAuthenticationFailure(HttpServletRequest req, HttpServletResponse resp, AuthenticationException exception) throws IOException, ServletException {
String temp ="";
if (userDetailsService.realUser != null){
if (userDetailsService.realUser.getIsLocked().equals(Constants.YesNo.NO)) {//未被锁定密码错误
temp="密码错误";
// resp.sendRedirect("login.html");
}else {//已经锁定的账号
temp="您输入错误密码的次数已达5次,账号已被锁定,请联系管理员解锁";
// resp.sendRedirect("login.html");您输入错误密码的次数已达5次账号已被锁定请联系管理员解锁
}
}else {//用户不存在
temp="用户不存在";
// resp.sendRedirect("login.html");
}
String msg = ""; String msg = "";
if (exception instanceof BadCredentialsException) { if (exception instanceof BadCredentialsException) {
msg = temp;
msg = "帐号或密码错误";
} else if (exception instanceof UsernameNotFoundException) { } else if (exception instanceof UsernameNotFoundException) {
msg = "帐号不存在"; msg = "帐号不存在";
} else if (exception instanceof LockedException) { } else if (exception instanceof LockedException) {

+ 2
- 19
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/AuthenticationSuccessHandler.java View File

@ -2,12 +2,9 @@ package com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication
import java.io.IOException; import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ciotea.cdcng.front.domain.repository.system.UserRepository;
import com.ciotea.cdcng.front.infrastructure.spring.security.userdetails.UserDetailsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
@ -16,7 +13,6 @@ import com.ciotea.cdcng.front.domain.log.userLogin.UserLoginLog;
import com.ciotea.cdcng.front.domain.log.userLogin.UserLoginLogServer; import com.ciotea.cdcng.front.domain.log.userLogin.UserLoginLogServer;
import com.ciotea.cdcng.front.domain.service.system.UserService; import com.ciotea.cdcng.front.domain.service.system.UserService;
import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil; import com.ciotea.cdcng.front.infrastructure.support.utils.ServletUtil;
import org.springframework.security.core.userdetails.UserDetails;
public class AuthenticationSuccessHandler implements org.springframework.security.web.authentication.AuthenticationSuccessHandler { public class AuthenticationSuccessHandler implements org.springframework.security.web.authentication.AuthenticationSuccessHandler {
@ -27,26 +23,13 @@ public class AuthenticationSuccessHandler implements org.springframework.securit
@Autowired @Autowired
private UserLoginLogServer userLoginLogServer; private UserLoginLogServer userLoginLogServer;
@Autowired
private UserDetailsService userDetailsService;
@Resource
UserRepository userRepository;
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest req, HttpServletResponse resp, Authentication authentication) throws IOException { public void onAuthenticationSuccess(HttpServletRequest req, HttpServletResponse resp, Authentication authentication) throws IOException {
String username = req.getParameter("username"); String username = req.getParameter("username");
String password = req.getParameter("password"); String password = req.getParameter("password");
/*--------0908--------*/
//捕捉到登陆成功把错误次数改为0
User dbUser = userRepository.getByUserName(username);
dbUser.setCount(0);
userRepository.updateByUsername(dbUser);
/*--------0908--------*/
String ip = req.getHeader( " x-forwarded-for " ); String ip = req.getHeader( " x-forwarded-for " );
if (ip == null || ip.length() == 0 || " unknown ".equalsIgnoreCase(ip)){ if (ip == null || ip.length() == 0 || " unknown ".equalsIgnoreCase(ip)){
ip = req.getHeader( " Proxy-Client-IP " ); ip = req.getHeader( " Proxy-Client-IP " );

+ 1
- 0
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/MyLogoutSuccessHandler.java View File

@ -17,6 +17,7 @@ public class MyLogoutSuccessHandler implements LogoutSuccessHandler {
boolean flag = false; boolean flag = false;
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if (cookie != null) { if (cookie != null) {
System.out.println(cookie);
flag = cookie.toString().equals("sso"); flag = cookie.toString().equals("sso");
if (flag) { if (flag) {
break; break;

+ 2
- 1
src/main/resources/mybatis/yunsa/car/carMapper.xml View File

@ -103,7 +103,8 @@
left join cngcd_cngtypedict cngType on car.cng_type_id = cngType.id left join cngcd_cngtypedict cngType on car.cng_type_id = cngType.id
left join authority_department regDept on car.reg_dept_id = regDept.id left join authority_department regDept on car.reg_dept_id = regDept.id
left join cngcd_bottle bott on car.id =bott.car_id left join cngcd_bottle bott on car.id =bott.car_id
where car.row_state = 1 and bott.next_check_date >= (select convert(char(10),getdate(),120))
where car.row_state = 1
and bott.next_check_date >= (select convert(char(10),getdate(),120))
) as carview where 1 = 1 ) as carview where 1 = 1
<if test="plateNum != null and plateNum != '' "> <if test="plateNum != null and plateNum != '' ">
and carview.platenum like '%' + #{plateNum} + '%' and carview.platenum like '%' + #{plateNum} + '%'

+ 2
- 4
src/main/resources/spring/ctx-mvc.xml View File

@ -84,7 +84,8 @@
</mvc:interceptors> </mvc:interceptors>
<mvc:default-servlet-handler /> <mvc:default-servlet-handler />
<!-- 带CNG前缀配置和不带CNG前缀配置 -->
<!-- 配置跳转页面URL-->
<!-- <mvc:view-controller path="/frame" view-name="/system/frame/frame.jsp" /> <!-- <mvc:view-controller path="/frame" view-name="/system/frame/frame.jsp" />
<mvc:view-controller path="/login" view-name="/system/login/login.jsp" /> <mvc:view-controller path="/login" view-name="/system/login/login.jsp" />
<mvc:view-controller path="" view-name="/system/login/login.jsp" /> <mvc:view-controller path="" view-name="/system/login/login.jsp" />
@ -94,12 +95,9 @@
<mvc:view-controller path="/" view-name="/system/frame/frame.jsp" /> <mvc:view-controller path="/" view-name="/system/frame/frame.jsp" />
<mvc:view-controller path="/login" view-name="/system/login/login.jsp" /> <mvc:view-controller path="/login" view-name="/system/login/login.jsp" />
<mvc:view-controller path="/login-pwd" view-name="/system/login/login.jsp" /> <mvc:view-controller path="/login-pwd" view-name="/system/login/login.jsp" />
<mvc:view-controller path="/ssoLoginCenter" view-name="/system/login/ssoLoginCenter.jsp" />
<mvc:view-controller path="/loginEntry" view-name="/system/login/loginEntry.jsp" /> <mvc:view-controller path="/loginEntry" view-name="/system/login/loginEntry.jsp" />
<mvc:view-controller path="/public" view-name="/app/public/public.jsp" /> <mvc:view-controller path="/public" view-name="/app/public/public.jsp" />
<!-- <!--
<bean id="exceptionHandler" class="com.ciotea.cdcng.front.infrastructure.spring.web.servlet.HttpStatusHandlerExceptionResolver" /> <bean id="exceptionHandler" class="com.ciotea.cdcng.front.infrastructure.spring.web.servlet.HttpStatusHandlerExceptionResolver" />
--> -->

+ 2
- 8
src/main/resources/spring/ctx-security.xml View File

@ -12,9 +12,8 @@
<security:http use-expressions="true" pattern="/**" entry-point-ref="loginUrlEntryPoint" authentication-manager-ref="authenticationManager" access-decision-manager-ref="accessDecisionManager"> <security:http use-expressions="true" pattern="/**" entry-point-ref="loginUrlEntryPoint" authentication-manager-ref="authenticationManager" access-decision-manager-ref="accessDecisionManager">
<security:access-denied-handler ref="accessDeniedHandler" /> <security:access-denied-handler ref="accessDeniedHandler" />
<security:custom-filter ref="exceptionResolverFilter" position="FIRST" /> <security:custom-filter ref="exceptionResolverFilter" position="FIRST" />
<security:form-login login-page="/" username-parameter="username" password-parameter="password" login-processing-url="/doLogin" authentication-success-handler-ref="authenticationSuccessHandler" authentication-failure-handler-ref="authenticationFailureHandler" />
<security:form-login login-page="/login" username-parameter="username" password-parameter="password" login-processing-url="/doLogin" authentication-success-handler-ref="authenticationSuccessHandler" authentication-failure-handler-ref="authenticationFailureHandler" />
<security:logout delete-cookies="JSESSIONID" invalidate-session="true" logout-url="/logout" logout-success-url="/loginEntry" /> <security:logout delete-cookies="JSESSIONID" invalidate-session="true" logout-url="/logout" logout-success-url="/loginEntry" />
<!-- <security:logout delete-cookies="JSESSIONID" invalidate-session="true" logout-url="/logout" success-handler-ref="MyLogoutSuccessHandler" logout-success-url="/loginEntry" />-->
<security:custom-filter ref="certificateLoginFilter" after="FORM_LOGIN_FILTER" /> <security:custom-filter ref="certificateLoginFilter" after="FORM_LOGIN_FILTER" />
<security:session-management session-fixation-protection="migrateSession"> <security:session-management session-fixation-protection="migrateSession">
<security:concurrency-control error-if-maximum-exceeded="false" max-sessions="300" expired-url="/login" /> <security:concurrency-control error-if-maximum-exceeded="false" max-sessions="300" expired-url="/login" />
@ -36,9 +35,7 @@
<security:intercept-url pattern="/ws/*" access="permitAll" /> <security:intercept-url pattern="/ws/*" access="permitAll" />
<security:intercept-url pattern="/loginEntry" access="permitAll" /> <security:intercept-url pattern="/loginEntry" access="permitAll" />
<security:intercept-url pattern="/login" access="permitAll" /> <security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/ssoLoginCenter" access="permitAll" />
<security:intercept-url pattern="/" method="GET" access="permitAll" />
<security:intercept-url pattern="/frame" access="permitAll" />
<security:intercept-url pattern="/login-pwd" access="permitAll" />
<security:intercept-url pattern="/public/**" access="permitAll" /> <security:intercept-url pattern="/public/**" access="permitAll" />
<security:intercept-url pattern="/special-service/**" access="permitAll" /> <security:intercept-url pattern="/special-service/**" access="permitAll" />
<security:intercept-url pattern="/facade/checkCodeImg" access="permitAll" /> <security:intercept-url pattern="/facade/checkCodeImg" access="permitAll" />
@ -61,7 +58,6 @@
<security:intercept-url pattern="/" access="isAuthenticated()" /> <security:intercept-url pattern="/" access="isAuthenticated()" />
<security:intercept-url pattern="/facade/**" access="isAuthenticated()" /> <security:intercept-url pattern="/facade/**" access="isAuthenticated()" />
<security:intercept-url pattern="/system/**" access="isAuthenticated()" /> <security:intercept-url pattern="/system/**" access="isAuthenticated()" />
<security:intercept-url pattern="/system/point/getUser" access="permitAll" />
<security:intercept-url pattern="/**" access="denyAll" /> <security:intercept-url pattern="/**" access="denyAll" />
</security:http> </security:http>
@ -93,8 +89,6 @@
<bean id="authenticationSuccessHandler" class="com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication.AuthenticationSuccessHandler" /> <bean id="authenticationSuccessHandler" class="com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication.AuthenticationSuccessHandler" />
<bean id="authenticationFailureHandler" class="com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication.AuthenticationFailureHandler" /> <bean id="authenticationFailureHandler" class="com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication.AuthenticationFailureHandler" />
<!-- &lt;!&ndash;自定义退出登录&ndash;&gt;-->
<!-- <bean id="MyLogoutSuccessHandler" class="com.ciotea.cdcng.front.infrastructure.spring.security.web.authentication.MyLogoutSuccessHandler" />-->
<!-- 授权 --> <!-- 授权 -->
<bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased"> <bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
<constructor-arg name="decisionVoters"> <constructor-arg name="decisionVoters">

BIN
src/main/webapp/WEB-INF/lib/activation-1.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/activemq-client-5.10.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/activemq-jms-pool-5.10.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/activemq-pool-5.10.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/ant-1.8.2.jar View File


BIN
src/main/webapp/WEB-INF/lib/ant-launcher-1.8.2.jar View File


BIN
src/main/webapp/WEB-INF/lib/antlr-2.7.7.jar View File


BIN
src/main/webapp/WEB-INF/lib/aopalliance-1.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/app-infrastructure-0.0.1-SNAPSHOT.jar View File


BIN
src/main/webapp/WEB-INF/lib/asm-3.3.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/aspectjweaver-1.8.2.jar View File


BIN
src/main/webapp/WEB-INF/lib/bcmail-jdk15-1.45.jar View File


BIN
src/main/webapp/WEB-INF/lib/bcprov-jdk15-1.45.jar View File


BIN
src/main/webapp/WEB-INF/lib/c3p0-0.9.1.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/classmate-1.0.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-beanutils-1.8.3.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-codec-1.10.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-collections-3.2.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-csv-1.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-digester-1.8.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-fileupload-1.5.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-io-2.2.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-lang3-3.3.2.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-net-3.3.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-pool-1.6.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-pool2-2.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/commons-validator-1.4.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-api-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-bindings-soap-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-bindings-xml-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-core-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-databinding-jaxb-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-frontend-jaxws-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-frontend-simple-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-transports-http-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-transports-http-jetty-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-ws-addr-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/cxf-rt-ws-policy-2.7.4.jar View File


BIN
src/main/webapp/WEB-INF/lib/dom4j-1.6.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/fastjson-1.2.47.jar View File


BIN
src/main/webapp/WEB-INF/lib/geronimo-j2ee-management_1.1_spec-1.0.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/geronimo-jms_1.1_spec-1.1.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/geronimo-jta_1.0.1B_spec-1.0.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/geronimo-servlet_3.0_spec-1.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/hamcrest-core-1.1.jar View File


BIN
src/main/webapp/WEB-INF/lib/hawtbuf-1.10.jar View File


BIN
src/main/webapp/WEB-INF/lib/hibernate-commons-annotations-4.0.5.Final.jar View File


BIN
src/main/webapp/WEB-INF/lib/hibernate-core-4.3.7.Final.jar View File


BIN
src/main/webapp/WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar View File


BIN
src/main/webapp/WEB-INF/lib/hibernate-validator-5.2.0.Beta1.jar View File


BIN
src/main/webapp/WEB-INF/lib/iTrusCertAPI-2.7.9.jar View File


BIN
src/main/webapp/WEB-INF/lib/jackson-annotations-2.4.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/jackson-core-2.4.3.jar View File


BIN
src/main/webapp/WEB-INF/lib/jackson-core-asl-1.9.13.jar View File


BIN
src/main/webapp/WEB-INF/lib/jackson-databind-2.4.3.jar View File


BIN
src/main/webapp/WEB-INF/lib/jackson-mapper-asl-1.9.13.jar View File


BIN
src/main/webapp/WEB-INF/lib/jandex-1.1.0.Final.jar View File


BIN
src/main/webapp/WEB-INF/lib/javassist-3.18.1-GA.jar View File


BIN
src/main/webapp/WEB-INF/lib/javax.el-api-3.0.1-b04.jar View File


BIN
src/main/webapp/WEB-INF/lib/javax.servlet-api-3.1.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/jaxb-impl-2.1.13.jar View File


BIN
src/main/webapp/WEB-INF/lib/jboss-logging-3.1.3.GA.jar View File


BIN
src/main/webapp/WEB-INF/lib/jboss-logging-annotations-1.2.0.Beta1.jar View File


BIN
src/main/webapp/WEB-INF/lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar View File


BIN
src/main/webapp/WEB-INF/lib/jedis-2.6.0.jar View File


BIN
src/main/webapp/WEB-INF/lib/jetty-continuation-8.1.7.v20120910.jar View File


BIN
src/main/webapp/WEB-INF/lib/jetty-http-8.1.7.v20120910.jar View File


BIN
src/main/webapp/WEB-INF/lib/jetty-io-8.1.7.v20120910.jar View File


BIN
src/main/webapp/WEB-INF/lib/jetty-security-8.1.7.v20120910.jar View File


BIN
src/main/webapp/WEB-INF/lib/jetty-server-8.1.7.v20120910.jar View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save