Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
robbietree8 committed Feb 9, 2022
1 parent d682094 commit 8ed2336
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public interface CustomerServiceI {

public Response addCustomer(CustomerAddCmd customerAddCmd);
Response addCustomer(CustomerAddCmd customerAddCmd);

public MultiResponse<CustomerDTO> listByName(CustomerListByNameQry customerListByNameQry);
MultiResponse<CustomerDTO> listByName(CustomerListByNameQry customerListByNameQry);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

//Assume that the credit info is in antoher distributed Service
public interface CreditGateway {
public Credit getCredit(String customerId);
Credit getCredit(String customerId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
import ${package}.domain.customer.Customer;

public interface CustomerGateway {
public Customer getByById(String customerId);
Customer getByById(String customerId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
@Mapper
public interface CustomerMapper{

public CustomerDO getById(String customerId);
CustomerDO getById(String customerId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private Object handleException(ProceedingJoinPoint joinPoint, Throwable e) {
return ResponseHandler.handle(returnType, "UNKNOWN_ERROR", e.getMessage());
}


private void logResponse(long startTime, Object response) {
try{
long endTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static Object handle(Class returnType, BaseException e){
}



private static Object handleColaResponse(Class returnType, String errCode, String errMsg) {
try {
Response response = (Response)returnType.newInstance();
Expand All @@ -41,7 +40,6 @@ private static Object handleColaResponse(Class returnType, String errCode, Strin
}
}


private static boolean isColaResponse(Class returnType) {
return returnType == Response.class || returnType.getGenericSuperclass() == Response.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
* @date 2019-03-01 10:06 AM
*/
public interface MetricsServiceI {
public Response addATAMetric(ATAMetricAddCmd cmd);
public Response addSharingMetric(SharingMetricAddCmd cmd);
public Response addPatentMetric(PatentMetricAddCmd cmd);
public Response addPaperMetric(PaperMetricAddCmd cmd);
public Response addRefactoringMetric(RefactoringMetricAddCmd cmd);
public Response addMiscMetric(MiscMetricAddCmd cmd);
public Response addCodeReviewMetric(CodeReviewMetricAddCmd cmd);
public Response deleteMetric(MetricDeleteCmd cmd);
public MultiResponse<ATAMetricCO> listATAMetrics(ATAMetricQry ataMetricQry);
Response addATAMetric(ATAMetricAddCmd cmd);
Response addSharingMetric(SharingMetricAddCmd cmd);
Response addPatentMetric(PatentMetricAddCmd cmd);
Response addPaperMetric(PaperMetricAddCmd cmd);
Response addRefactoringMetric(RefactoringMetricAddCmd cmd);
Response addMiscMetric(MiscMetricAddCmd cmd);
Response addCodeReviewMetric(CodeReviewMetricAddCmd cmd);
Response deleteMetric(MetricDeleteCmd cmd);
MultiResponse<ATAMetricCO> listATAMetrics(ATAMetricQry ataMetricQry);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* @date 2019-02-28 6:15 PM
*/
public interface UserProfileServiceI {
public Response addUserProfile(UserProfileAddCmd cmd);
public Response updateUserProfile(UserProfileUpdateCmd cmd);
public Response refreshScore(RefreshScoreCmd cmd);
public SingleResponse<UserProfileCO> getUserProfileBy(UserProfileGetQry qry);
public MultiResponse<UserProfileCO> listUserProfileBy(UserProfileListQry qry);
Response addUserProfile(UserProfileAddCmd cmd);
Response updateUserProfile(UserProfileUpdateCmd cmd);
Response refreshScore(RefreshScoreCmd cmd);
SingleResponse<UserProfileCO> getUserProfileBy(UserProfileGetQry qry);
MultiResponse<UserProfileCO> listUserProfileBy(UserProfileListQry qry);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* @date 2020-07-02 12:16 PM
*/
public interface MetricGateway {
public void save(MetricItem metricItem);
public List<SubMetric> listByTechContribution(String userId);
public List<SubMetric> listByTechInfluence(String userId);
public BugMetric getBugMetric(String userId);
public AppMetric getAppMetric(String userId);
void save(MetricItem metricItem);
List<SubMetric> listByTechContribution(String userId);
List<SubMetric> listByTechInfluence(String userId);
BugMetric getBugMetric(String userId);
AppMetric getAppMetric(String userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @date 2020-07-02 12:16 PM
*/
public interface UserProfileGateway {
public void create(UserProfile userProfile);
public void update(UserProfile userProfile);
public UserProfile getByUserId(String userId);
void create(UserProfile userProfile);
void update(UserProfile userProfile);
UserProfile getByUserId(String userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class UserProfile {
private ContributionMetric contributionMetric;
private DevQualityMetric devQualityMetric;

private static double MAXIMUM_SCORE = 100;
private static double MINIMUM_SCORE = 0;
private static final double MAXIMUM_SCORE = 100;
private static final double MINIMUM_SCORE = 0;

public void calculateScore(){
calculateTechInfluenceScore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public void save(MetricItem metricItem){
domainEventPublisher.publish(metricItemCreatedEvent);
}


public List<SubMetric> listByTechContribution(String userId){
List<MetricDO> metricDOList = metricMapper.listByMainMetric(userId, MainMetricType.TECH_CONTRIBUTION.getMetricCode());
RefactoringMetric refactoringMetric = new RefactoringMetric();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<package name="com.alibaba.craftsman.gatewayimpl.database.dataobject"/>
</typeAliases>
<mappers>
<mapper resource="mybatis/MetricMapper.xml"></mapper>
<mapper resource="mybatis/UserProfileMapper.xml"></mapper>
<mapper resource="mybatis/MetricMapper.xml" />
<mapper resource="mybatis/UserProfileMapper.xml" />
</mappers>
</configuration>

0 comments on commit 8ed2336

Please sign in to comment.