Commit b507aac8d848a3082246de2542a244c18dd73318
1 parent
5502c360
m
Showing
2 changed files
with
27 additions
and
11 deletions
trash-quartz/src/main/java/com/trash/quartz/task/DriverTask.java
| ... | ... | @@ -24,6 +24,7 @@ import com.trash.business.domain.CompanyCredit; |
| 24 | 24 | import com.trash.business.domain.DriverCredit; |
| 25 | 25 | import com.trash.business.domain.SupervisionThreestep; |
| 26 | 26 | import com.trash.business.domain.TruckCredit; |
| 27 | +import com.trash.business.mapper.CompanyCreditMapper; | |
| 27 | 28 | import com.trash.business.mapper.SupervisionThreestepMapper; |
| 28 | 29 | import com.trash.business.service.ICompanyCreditService; |
| 29 | 30 | import com.trash.business.service.IDriverCreditService; |
| ... | ... | @@ -94,7 +95,8 @@ public class DriverTask |
| 94 | 95 | |
| 95 | 96 | |
| 96 | 97 | private void checkDriverCredit() { |
| 97 | - | |
| 98 | + | |
| 99 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 98 | 100 | if(RemoteServerUtils.remote == null){ |
| 99 | 101 | RemoteServerUtils.remote = trashConfig.getRemotePath(); |
| 100 | 102 | } |
| ... | ... | @@ -134,14 +136,14 @@ public class DriverTask |
| 134 | 136 | |
| 135 | 137 | } |
| 136 | 138 | |
| 137 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 138 | 139 | |
| 139 | 140 | |
| 140 | 141 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| 141 | 142 | private void checkTruckCredit() { |
| 143 | + | |
| 144 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 142 | 145 | Map map = new HashMap<>(); |
| 143 | 146 | map.put("size",9999); |
| 144 | - map.put("dishonestState",0); | |
| 145 | 147 | map.put("valid",0); |
| 146 | 148 | map.put("page",1); |
| 147 | 149 | |
| ... | ... | @@ -207,11 +209,11 @@ public class DriverTask |
| 207 | 209 | } catch (Exception e) { |
| 208 | 210 | e.printStackTrace(); |
| 209 | 211 | } |
| 210 | - | |
| 212 | + | |
| 213 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 211 | 214 | |
| 212 | 215 | Map map = new HashMap<>(); |
| 213 | 216 | map.put("size",9999); |
| 214 | - map.put("dishonestState",0); | |
| 215 | 217 | map.put("page",1); |
| 216 | 218 | |
| 217 | 219 | JSONArray companys = RemoteServerUtils.getCompanyList(map,TOKEN); |
| ... | ... | @@ -243,7 +245,7 @@ public class DriverTask |
| 243 | 245 | companyCredit.setLostCredit(1L); |
| 244 | 246 | companyCredit.setStatus(0L); |
| 245 | 247 | |
| 246 | - List<CompanyCredit> companyList = SpringUtils.getBean(ICompanyCreditService.class).selectCompanyCreditList(companyCredit); | |
| 248 | + List<CompanyCredit> companyList = SpringUtils.getBean(CompanyCreditMapper.class).selectCompanyCreditList(companyCredit); | |
| 247 | 249 | |
| 248 | 250 | for(CompanyCredit c:companyList){ |
| 249 | 251 | SpringUtils.getBean(ICompanyCreditService.class).updateRemoteCompanyAndTruck(c,TOKEN); | ... | ... |
trash-workFlow/src/main/java/com/trash/business/service/impl/CompanyCreditServiceImpl.java
| ... | ... | @@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject; |
| 15 | 15 | import com.trash.business.domain.CompanyCredit; |
| 16 | 16 | import com.trash.business.domain.TruckCredit; |
| 17 | 17 | import com.trash.business.mapper.CompanyCreditMapper; |
| 18 | +import com.trash.business.mapper.TruckCreditMapper; | |
| 18 | 19 | import com.trash.business.service.ICompanyCreditService; |
| 19 | 20 | import com.trash.business.service.ITruckCreditService; |
| 20 | 21 | import com.trash.common.core.redis.RedisCache; |
| ... | ... | @@ -33,8 +34,10 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 33 | 34 | private CompanyCreditMapper companyCreditMapper; |
| 34 | 35 | |
| 35 | 36 | @Autowired |
| 36 | - private ITruckCreditService truckService;; | |
| 37 | - | |
| 37 | + private TruckCreditMapper truckMapper; | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + private ITruckCreditService truckService; | |
| 38 | 41 | @Autowired |
| 39 | 42 | RedisCache redisCache; |
| 40 | 43 | /** |
| ... | ... | @@ -111,9 +114,20 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 111 | 114 | } |
| 112 | 115 | |
| 113 | 116 | public void insertCompanyCredit(CompanyCredit companyCredit, String token) { |
| 114 | - companyCredit.setTime(new Date()); | |
| 117 | + int i = 0; | |
| 118 | + CompanyCredit cc = new CompanyCredit(); | |
| 119 | + | |
| 120 | + cc.setStatus(0L); | |
| 121 | + cc.setLostCredit(companyCredit.getLostCredit()); | |
| 122 | + cc.setObjectId(companyCredit.getObjectId()); | |
| 115 | 123 | |
| 116 | - int i = companyCreditMapper.insertCompanyCredit(companyCredit); | |
| 124 | + List old = companyCreditMapper.selectCompanyCreditList(cc); | |
| 125 | + | |
| 126 | + if (old.size() > 0) { | |
| 127 | + i = 1; | |
| 128 | + } else { | |
| 129 | + i = companyCreditMapper.insertCompanyCredit(companyCredit); | |
| 130 | + } | |
| 117 | 131 | |
| 118 | 132 | updateRemoteCompanyAndTruck(companyCredit, token); |
| 119 | 133 | |
| ... | ... | @@ -158,7 +172,7 @@ public class CompanyCreditServiceImpl implements ICompanyCreditService { |
| 158 | 172 | tredit.setStatus(0L); |
| 159 | 173 | tredit.setObjectId(truckId); |
| 160 | 174 | |
| 161 | - List<TruckCredit> oldData = truckService.selectTruckCreditList(tredit); | |
| 175 | + List<TruckCredit> oldData = truckMapper.selectTruckCreditList(tredit); | |
| 162 | 176 | TruckCredit data; |
| 163 | 177 | if (oldData.size() > 0) { |
| 164 | 178 | data = oldData.get(0); | ... | ... |